1、docker search
usage: docker search [options] term
search the docker hub for images(從docker倉庫查詢映象資訊)
2、docker pull
usage: docker pull [options] name[:tag|@digest]
pull an image or a repository from a registry(從倉庫拉去映象)
3、docker images
usage: docker images [options] [repository[:tag]]
list images(列出本地映象)
4、docker run/docker create
usage: docker run [options] image [command] [arg...]
run a command in a new container(執行乙個新的容器)
-i, --interactive keep stdin open even if not attached
-t, --tty allocate a pseudo-tty
-d, --detach run container in background and print container id
-p, --publish value publish a container's port(s) to the host (default )
-p, --publish-all publish all exposed ports to random ports
--name string assign a name to the container
--link value add link to another container (default )
usage: docker create [options] image [command] [arg...]
create a new container(建立乙個新的容器,但不啟動它,用法同docker run)
5、docker ps
usage: docker ps [options]
list containers(列出本地容器)
-a, --all show all containers (default shows just running)
6、docker exec
usage: docker exec [options] container command [arg...]
run a command in a running container(在乙個執行的容器中執行命令)
-d, --detach detached mode: run command in the background
-i, --interactive keep stdin open even if not attached
-t, --tty allocate a pseudo-tty
7、docker stop|start|restart
usage: docker stop [options] container [container...]
stop one or more running containers
usage: docker start [options] container [container...]
start one or more stopped containers
usage: docker restart [options] container [container...]
restart a container
8、docker kill
usage: docker kill [options] container [container...]
kill one or more running containers
9、docker rm
usage: docker rm [options] container [container...]
remove one or more containers(刪除乙個或多個容器)
-f, --force force the removal of a running container (uses sigkill)
10、docker rmi
usage: docker rmi [options] image [image...]
remove one or more images(刪除乙個或多個映象)
-f, --force force removal of the image
11、docker commit
usage: docker commit [options] container [repository[:tag]]
create a new image from a container's changes
注意:docker commit不能儲存volumn中變化的資料(docker mysql資料持久化會遇到類似的問題)。
12、docker diff
usage: docker diff container
inspect changes on a container's filesystem
13、docker cp
usage: docker cp [options] container:src_path dest_path|-
docker cp [options] src_path|- container:dest_path
copy files/folders between a container and the local filesystem(在容器和本地檔案系統中拷貝檔案或目錄)
14、docker port
15、docker rename
usage: docker rename container new_name
rename a container(容器重新命名)
docker常用命令 Docker 常用命令筆錄
格式docker run 選項 映象 命令 引數.示例docker run it rm ubuntu 16.04 bash 示例解釋 it 這是兩個引數,乙個是 i,表示互動式操作,乙個是 t表示終端 rm 這個引數是說容器退出後隨之將其刪除 ubuntu 16.04 這是指用ubuntu 16.0...
docker常用命令
1.刪除已退出的容器 docker rm docker ps a q 2.強制刪除所有容器 docker rm f docker ps a 3.docker attach 進不去的時候可以用docker exec it containerid bin bash docker run it ubunt...
docker常用命令
docker常用命令 1.進入docker容器 sudo docker run it insaneworks centos bin bash 使用ctrl p或者ctrl q可以進入和退出容器 2.拉去乙個映象 docker pull insaneworks centos 檢視所有的映象 docke...