In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
How to deploy nginx in the docker container, many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can get something.
1. Find Mirror
Docker search nginx
two。 Pull the official Nginx image
Docker pull nginx
3. Create a local data volume:
Mkdir-p / home/nginx/www / home/nginx/logs / home/nginx/conf
4. Add host directory permissions
Chmod-R 777 / home/nginx/www
5. The default profile starts the nginx container:
Docker run-- rm-- name nginx-test-p 80:80-d nginx
6. Copy the configuration file to the local directory:
Docker cp Container id:/etc/nginx/nginx.conf / home/nginx/conf
7. Enter the container:
Docker container exec-it container id / bin/sh
8. Start the nginx container to mount the host directory and map the port
Docker run-d-p 80:80-- name nginx-test-web\
-v / home/nginx/www:/usr/share/nginx/html\
-v / home/nginx/conf/nginx.conf:/etc/nginx/nginx.conf\
-v / home/nginx/logs:/var/log/nginx\
-- privileged=true nginx:1.15.7-alpine
Image recovery and migration
1. The container is saved as a mirror
Docker commit Container name Image name
two。 Mirror backup
Docker save-o mynginx.tar mynginx
3. Upload and import images
Upload: rz
Download: sz file name
Docker load-I mynginx.tar
Other common docker commands:
Delete container: docker rm container id
Delete image: docker rmi image id
Install tree:yum-y install tree
View directory: tree directory name.
Docker run is used only the first time it is run, putting the image in a container, and when you start the container again later, you only need to use the command docker start.
Docker run is equivalent to two steps: put the image in the container (docker create), and then launch the container to make it a run-time container (docker start).
The purpose of docker start is to restart an existing mirror. That is, if we use this command, we must know the ID of the container, or the name of the container, and we can use docker ps to find the information about the container.
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.