First, there is a centos7 + system (7.5) installed docker: yum -y install docker start the service: systemctl start docker set boot docker: systemctl enable docker version View: docker version System Information: docker info download mirror: CentOS: Docker Search CentOS pull official centos: docker pull docker.io/centos replacement mirror address: 1.docker Chinese official District: HTTPS: //registry.docker-cn.com 2. NetEase: HTTP: //hub-mirror.c.163.com 3 .ustc: https://docker.mirrors.ustc.edu.cn edit data replacement source: VI /etc/docker/daemon.json { "Registry-Mirrors": [ "https://registry.docker-cn.com "] } restart docker restart to take effect: systemctl restart docker.service View Download mirror: docker images open network forwarding function: automatically open the default manually open: vim /etc/sysctl.conf Insert: net.ipv4.ip_forward = 1 entry into force: sysctl -p verification: CAT / proc / SYS / NET / ipv4 / ip_forward 1, run, stop, disable firewalld start: # systemctl start firewalld view the status: # systemctl status firewalld or firewall -cmd --state stop: # systemctl disable firewalld disabled: # systemctl stop firewalld start centos: docker run -it docker.io/centos:latest / bin / bash into the container to see version: CAT / etc / RedHat-release CentOS Release 7.6.1810 linux (Core) -i interactive mode -t assigned pseudo-terminal helloword container: docker run -d docker.io/centos:latest / bin / sh -c "while true; do echo hello word; sleep 1; done " View container logs: docker logs 8f8e1924fabb -f (real-time output) kill container: docker kill container id closed container: docker stop container id start container: docker start container id reboot: docker restart container id remove the container: docker rm container id Docker image generation there are two methods: the current state of the container 1.docker commit # saved to the image, and then generates the corresponding new Image 2.docker Build # file using Dockerfile automated production Image 1. presentation: Docker RUN -it docker.io/centos:latest / bin / bash install apache: yum -y install httpd out of the container exit submit: docker commit 939a4f2c8851 liwei / apache (certain lowercase) to view mirror came out remove the mirror: docker rmi id with a new image: docker run -it liwei / apache / bin / bash into the container: before installing check whether there is: httpd RPM -qa Docker RUN -it -p 9090: 80 Liwei / the Apache / bin / bash see container configuration: docker inspect containers id can view this container ip oh: 172.18.0.2 into the start of the container: docker exec -it id name / bin / bash to view the start position of the container into the container after: find ./ -name ** apache ** start / usr / sbin / apachectl in: writing data outside the home directory created a.txt, Docker CP /home/a.txt container ID: / home Docker combat: Production python running environment uwsgi the Django + 1. New Dockerfile content: the FROM nginx RUN echo '<h1> the Hello, Docker </ h1>!'> /home/liwei/nginx/index.html save docker build -t mynginx: v1 (I can not start, the reason that last less. point) to view the image creation: docker images to start the mirror: docker run -itd -p 8080: 80 mynginx: v1 public network access: HTTP: //47.93.225.36: 8080 / the FROM Specifies the base image