頁(yè)內(nèi)導(dǎo)航
Docker命令
安裝完Docker之后,在控制臺(tái)中輸入
docker --help
可以查看所有的Docker命令,其中常用的命令如下:
Usage: docker COMMAND
A self-sufficient runtime for containers
Options:
--config string Location of client config files (default "/Users/****/.docker")
-D, --debug Enable debug mode
-H, --host list Daemon socket(s) to connect to
-l, --log-level string Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info")
--tls Use TLS; implied by --tlsverify
--tlscacert string Trust certs signed only by this CA (default "/Users/****/.docker/ca.pem")
--tlscert string Path to TLS certificate file (default "/Users/****/.docker/cert.pem")
--tlskey string Path to TLS key file (default "/Users/****/.docker/key.pem")
--tlsverify Use TLS and verify the remote
-v, --version Print version information and quit
Management Commands:
container Manage containers 管理container
image Manage images 管理docker鏡像
volume Manage volumes 管理數(shù)據(jù)卷
Commands:
build Build an image from a Dockerfile 從Dockerfile編譯一個(gè)鏡像
commit Create a new image from a container''s changes 從一個(gè)現(xiàn)有container編譯一個(gè)鏡像
cp Copy files/folders between a container and the local filesystem 在宿主機(jī)器和container之間傳遞文件和文件夾
exec Run a command in a running container 在一個(gè)運(yùn)行中的container上執(zhí)行命令
images List images 列出所有的鏡像
inspect Return low-level information on Docker objects 查看詳細(xì)docker各部件的詳細(xì)信息
kill Kill one or more running containers 停止一個(gè)container
login Log in to a Docker registry 登錄到docker hub
logout Log out from a Docker registry 登出
port List port mappings or a specific mapping for the container 羅列當(dāng)前container的所有端口映射關(guān)系
ps List containers 顯示正在運(yùn)行的container
pull Pull an image or a repository from a registry 從docker hub中獲取一個(gè)鏡像
push Push an image or a repository to a registry 發(fā)布一個(gè)鏡像到docker hub
rename Rename a container 重命名一個(gè)container
restart Restart one or more containers 重啟一個(gè)或者多個(gè)container
rm Remove one or more containers 移除一個(gè)或者多個(gè)container
rmi Remove one or more images 移除一個(gè)或多個(gè)鏡像
run Run a command in a new container 啟動(dòng)一個(gè)新的container
start Start one or more stopped containers 啟動(dòng)一個(gè)或多個(gè)container
stop Stop one or more running containers 停止一個(gè)或多個(gè)container
tag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE 從一個(gè)鏡像拷貝并重新命名為一個(gè)新的鏡像
version Show the Docker version information 顯示docker的版本信息
Run 'docker COMMAND --help' for more information on a command.
image 鏡像
docker images
顯示本地所有的鏡像
REPOSITORY TAG IMAGE ID CREATED SIZE
niweigede/ujava 1.1 5a662682895c 2 hours ago 490MB
docker image
Commands:
build Build an image from a Dockerfile
history Show the history of an image
inspect Display detailed information on one or more images
ls List images
prune Remove unused images
pull Pull an image or a repository from a registry
push Push an image or a repository to a registry
rm Remove one or more imagesSOURCE_IMAGE
container 容器
docker container
Commands:
attach Attach local standard input, output, and error streams to a running container
commit Create a new image from a container''s changes
cp Copy files/folders between a container and the local filesystem
create Create a new container
exec Run a command in a running container
inspect Display detailed information on one or more containers
kill Kill one or more running containers
logs Fetch the logs of a container
ls List containers
pause Pause all processes within one or more containers
port List port mappings or a specific mapping for the container
prune Remove all stopped containers
rename Rename a container
restart Restart one or more containers
rm Remove one or more containers
run Run a command in a new container
start Start one or more stopped containers
stop Stop one or more running containers
top Display the running processes of a container
系列文章
<Docker 1> Docker入門知識(shí)和安裝方式
<Docker 2> Docker的常用命令簡(jiǎn)介 當(dāng)前