systemctl start docker // Run Docker
Docker Network LS
Docker the Inspect Bridge
Docker RUN -d --name nginx3 nginx
// "IPv4Address": "172.18.0.2/16",
into the container
docker exec -it nginx4 bash
installation ping command
apt-get Update
yum commands are specific centos redhat and the install Git yum
Ubuntu APT-GET the install the install Git Git or APT
APT the install -Y-to inetutils of ping
of ping 172.18.0.2 /// nginx4 of ping nginx3 will point to the host IP
// hostname in connection nginx5 nginx3 the ping nginx3 in the ping
Docker RUN -d --name nginx5 --link nginx3 nginx
APT-GET -y install iproute2
Docker RUN -d --name nginx_host - Net host nginx
Docker host the Inspect
none and the host did not own ip address
ip addr
port mapping
Docker Image Inspect Nginx
docker run -d -p --name port_nginx 8080: 80
docker run -d -p --name port_nginx 80 Nginx
Docker comtainer Port port_nginx /// not specified, the mapping random port
docker run -d port --name port_nginx -P nginx vessel unknown exposure all exposed
Docker Create --driver network Bridge finance_web
Docker network LS
connecting a specified network IP
Docker network connect dev_web no_nginx
Compose container scheduling tool
mounting Compose
yum the install EPEL -Y-Release
yum PIP-Python the install -Y
PIP Compose the install Docker-
PIP-Docker Compose the install == 1.21.2
YAML format
Object name: guozimo
array
- Apple
- Banana
string:
age:"hello"
编写docker-compose.yml
cd /root
cd /usr/local/src
mkdir nginx
cd nginx
vi docker-compose.yml
内容如下
version: "2"
services:
nginx1:
image: nginx
ports:
- "8081:80"
nginx2:
image: nginx
ports:
- "8082:80"
Start
Docker Compose-up
ifconfig | grep 39
grep filter means
docker-compose up -d background
http://39.105.91.188:8082/
Docker Compose PS-
stop
Docker Compose-STOP
Docker Compose Start-start
docker-compose logs - f production log to see change
docker-compose down container delete deleted network
Docker Docker container container RM `PS -a -q`
Docker container PS -a view all vessels
// default to create Creating nginx_nginx1_1 ... such names done
static container resource does not modify data on the volume
yum the install -Y Tree
Tree
View the directory structure of
the local modification to modify the mapping does not need to enter the container
/usr/share/nginx/html 为nginx根目录 - "data:/data" 当数据卷处理
version: "2"
services:
nginx1:
image: nginx
networks:
- "myweb"
- "default"
volumes:
- "data:/data"
- "./front:/usr/share/nginx/html"
ports:
- "8081:80"
nginx2:
image: nginx
volumes:
- "data:/data"
- "./backend:/usr/share/nginx/html"
ports:
- "8082:80"
volumes:
data:
driver: local
networks:
myweb:
driver: bridge
/////////////////////
: Set nu show line numbers