標籤(linux): dockerhtml
關鍵字:node
docker pull images_name
[root@docker ~]# docker images
docker command --help
docker search nginx
#基於hello-world鏡像啓動一個容器,若是本地沒有鏡像會從公網拉取過來,此次作爲測試用 docker run hello-world
docker save -o image_name.tar image_name
docker rmi image_name
docker run --name=con_name images --name #設置容器名
docker commit -m "con_name" con_id image_name
docker run -it --name=con_name images -it #在啓動以後進入這個容器
docker run -d -p 81:80 image_name #-p 參數說明 -p hostPort:containerPort -p ip:hostPort:containerPort -p ip::containerPort -p hostPort:containerPort:udp
docker port con_id
docker ps
docker ps -a
docker logs -f con_name
docker attach con_name
# 方法一 exit # 方法二 ctrl+p && ctrl+q (一塊兒按,注意順序,退出後容器依然保持啓動狀態)
docker rm con_name #強制刪除須要加-f,不加-f不能刪除正在運行中的容器,很是危險,最好不用
[root@docker ~]# docker network ls NETWORK ID NAME DRIVER SCOPE 3f91f2097286 bridge bridge local d7675dbd247c docker_gwbridge bridge local 5b36c7e947fd host host local ims6qkpikafu ingress overlay swarm 85ba10e7ef79 none null local
docker network create -d bridge \ --subnet=192.168.0.0/24 \ --gateway=192.168.0.100 \ --ip-range=192.168.0.0/24 \ my-docker
#docker run --network=my-docker --ip=192.168.0.5 -itd --name=con_name -h lb01 image_name --network #指定容器網絡 --ip #設定容器ip地址 -h #給容器設置主機名
#方法一: docker top con_name #方法二: docker inspect --format "{{.State.Pid}}" con_name
docker build -t mysql:3.6.34 `pwd`
docker run -d -P -e MYSQL_ROOT_PASSWORD=password img_id
docker tag imageid name:tag
[root@docker ~]# cat nsenter.sh PID=`docker inspect --format "{{.State.Pid}}" $1` nsenter -t $PID -u --mount -i -n -p
docker network create --driver bridge --subnet 172.22.16.0/24 --gateway 172.22.16.1 my_net2
docker network connect my_net2 oldboy1
使用filebeat收集日誌mysql
{ "registry-mirrors": ["https://56px195b.mirror.aliyuncs.com"], "cluster-store":"consul://192.168.56.13:8500", "cluster-advertise": "192.168.56.11:2375", "log-driver": "fluentd", "log-opts": { "fluentd-address":"192.168.56.13:24224", "tag":"linux-node1.example.com" } }
Docker最佳實踐-部署LNMP環境
http://www.cnblogs.com/Csir/p/6888066.htmllinux