One
1. System Configuration Requirements
Operating system: 64-bit operating system and 3.10 or later kernel: uname-r
Docker-v1.12 and later
Docker compose-v1.8 and later
2. Update the system
Yum Update
3. Installation
Yum Install Dockeryum install python-pippip install docker-compose
4. Basic Docker command
View NPM version: Npm-v
View Docker versions: Docker version
Start: Systemctl start Docker.service boot: Systemctl enable Docker.service Help: Docker--Assistanceprofile: Docker info Mirror view: Docker images container view, process view, Docker ps-a
5. Test and install Nginx
(1) To download the image, Docker pull Nginx (2)Start Container, Docker run-d-P8080: theNginx to the container in the Nginx 80 port, mapped to the current server 8080 port, the current server IP is 192.168.1. -, the browser enters http://192.168.1.120:8080/, you can see that Nginx is started,(3)and start one more container ., Docker run-d-P8081: theNginx Browser input http://192.168.1.120:8081/, you can see that another nginx has been started or it can be tested with Curl 127.0.0.1:8081 to open the appropriate port(4Here, the difference between a Docker deployment application and a traditional deployment application is that the traditional deployment requires a manual copy of the Nginx, and then the port, and Docker deployment, on the basis of the created image, a command can deploy a new application
6, delete the test nginx
(1) Docker PS-A can display container ID stop container (2) Docker stop 8dc6a2b6f903 Delete container (3) Docker rm 8dc6a2b6f903
7, specify the parameters of the container nginx
Docker run--name nginx-0018081: -v/home/docker/nginx/html:/usr/share/nginx/html Nginx
The-p parameter maps the host's 8081 port to the container's 80 port
Note here that the-V is a data volume that can be shared between the host and the container/home/docker/nginx/html this directory, inside the container is/usr/share/nginx/html. In fact, this is our code directory, debugging code is to rely on shared directory implementation, very convenient!
You can use Curl 127.0.0.1:8081 to view, which will appear in 403 below
8, modify the configuration file inside the container
-it nginx-001 bash# Installation Tool apt-get updateaptInstall/etc/nginx/conf.d/ Default.conf
Fix Web page Access 403 error
Because the Web root of the Nginx configuration in the container is/usr/share/nginx/html, the directory corresponding to the systemis/home/docker/nginx//etc/selinux/config Change the SELinux =enforcing to selinux=disabled then reboot to delete the original container and republish the container. Access
Exit Container: Exit
See Address
http://blog.csdn.net/remote_roamer/article/details/51916893
001-docker installing "Nginx, MySQL"