docker数据卷
环境准备
服务器系统 | Centos7.3 |
---|---|
内存 | 1G |
CPU | 2核 |
IP地址 | 10.0.0.43 |
docker volume --help
docker volume create html
docker volume ls
docker run --name nginx -d -p 81:80 -v html:/usr/share/nginx/html nginx
cd /var/lib/docker/volumes/
ls
cd html/_data/
vim index.html
cat index.html
dkafmkaklklg
docker exec -it nginx /bin/bash
cd /usr/share/nginx/html/
cat index.html
echo 123 > index.html
cat index.html
exit
ls
cat index.html
docker stop nginx
docker rm nginx
docker run --name nginx -d -p 81:80 -v html:/usr/share/nginx/html nginx
docker run --name nginx1 -d -p 82:80 -v html:/usr/share/nginx/html nginx