Docker Usage
docker的四种状态(start/pause/restart/stop)
1 2
| docker info docker search
|
1 2
| docker pull docker pull centos:7.3.1611
|
1 2 3 4 5 6 7 8 9
| docker start happy_hahaha
docker restart happy_hahaha
docker stop happy_hahaha
docker pause happy_hahaha docker unpause happy_hahaha
|
1 2 3 4 5 6 7 8 9 10 11
| docker run --name centos7.3 -i -t centos:7.3.1611 /bin/bash
docker run --name centos7.3_d -i -t -d centos:7.3.1611 /bin/bash
docker run --restart=always
docker run --rm -it -v /host/data/:/data:rw happy_hahaha /bin/bash docker run --name centos7.3-elk -dit -v /Volumes/HDD/dockerdata:/data:rw -p 8080:80 -p 5601:5601 -p 9200:9200 --privileged=true shawnyan/docker:centos7.3.1611 /usr/sbin/init
docker rename centos7.3 centos7.3.1611
|
1 2
| docker exec -t -i centos7.3 /bin/bash docker exec -it centos7.3 /bin/bash
|
1 2 3 4 5 6 7
| docker images docker images shawnyan/docker docker image ls -a docker image rm <CONTAINER ID> docker image rm `docker image ls -a -q`
docker history <id>
|
1 2
| docker rm <CONTAINER ID> docker rm `docker ps -a -q`
|
1 2 3 4 5 6 7
| docker ps docker ps -a docker container ls -a
docker stats centos7.3 docker logs centos7.3 docker logs -ft centos7.3
|
1 2 3 4 5
| docker inspect centos7.3
|
1 2 3 4
| docker save -o ol7.tar oraclelinux:7-slim
docker load -i ol7.tar
|
1 2 3
| docker commit -m "comment" <CONTAINER ID> <user/repo> docker commit -m "centos7.3 core" -a "shawnyan" e819c4cb23a4 shawnyan/docker:centos7.3 docker commit -m "centos7_v2" -a "shawnyan" centos7 shawnyan/docker:centos7_v2
|
1
| docker push <user/repo:tag>
|