docker容器使用的相關命令
docker run -tid --name shop -h xxxx.com --add-host aaa.com:192.168.0.1 --add-host sss.com:192.168.0.1 --add-host ddd.com:192.168.0.1 --add-host wwwd.com:192.168.0.1 -v /opt/shop:/etc/nginx -p 127.0.0.1:87:80 php:5.5
docker run -tid --name php -h 12.10.46.77 -p 88:80 --restart=always -v /opt/shop:/etc/nginx php:5.5
d
docker run -tid --name wxEditor -p 85:80 -v /opt/wxEditor1.0.0:/opt/www php:5.6
docker run -tid --name php -p 85:80 -p 86:81 -p 88:82 -v /opt/php:/opt/www php:5.6
docker run -tid --name shop1 -h wwws.com --add-host aaa.com:192.168.0.1 -p 127.0.0.1:89:80 --restart=always -v /opt/shop1:/etc/nginx php:5.6
docker run -tid --name shopmobile -h shop.com --add-host ttt.com:192.168.0.1 --add-host ggg.com:192.168.0.1 -p 127.0.0.1:1881:80 --restart=always -v /opt/shopmobile:/opt/www -v /opt/shop/www/images:/opt/www/images php:5.6
session賦予許可權:/var/lib/php/session
docker run -tid --name wxEditor -p 127.0.0.1:1885:85 -p 127.0.0.1:1886:86 -p 127.0.0.1:1888:88 -v /opt/php:/opt/www php:5.6
docker run -tid --name ems -p 127.0.0.1:1881:80 --restart=always -v /opt/ems:/opt/www ems:v2
docker run -tid --name ems -h aaa5.com -p 8001:80 --restart=always -v /opt/ems:/opt/www ems:v2
docker run -tid --name ems -p 8001:80 --restart=always -v /opt/ems:/opt/www ems:v2
docker run -tid --name szhxy -p 127.0.0.1:1882:80 --restart=always -v /opt/ems_szhxy:/opt/www ems:v2
docker commit ems ems:v2 ---容器生成映象
docker export ems >ems.tar ---映象匯出成壓縮包-
上面的5.5可以更換為5.6 7.1 已實現不同php版本的切換
沒看到
docker run -i -t -v /root/software/:/mnt/software/ 83ee /bin/bash
有同學在docker下安裝了nginx 但是不知道目錄在哪,可以使用命令:
sudo find / -name "50x.html"
因為nginx裡必定會有50x.html,所以查詢它,結果發現nginx的目錄在docker容器裡,如果操作它,就需要進入容器的shell。
必須先啟動容器:
sudo docker start “容器ID”
然後使用下邊的命令進入shell:
sudo docker exec -it “容器ID” bash
將主機的檔案複製到容器裡:
sudo docker cp 主機目錄 容器ID:容器目錄
scp [email protected]:/root/php5.6.tar.gz /root
儲存映象:
docker commit nagios nagios:1.0
# /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg