頁內導航
Docker命令
安裝完Docker之后匕累,在控制臺中輸入
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 管理數據卷
Commands:
build Build an image from a Dockerfile 從Dockerfile編譯一個鏡像
commit Create a new image from a container''s changes 從一個現有container編譯一個鏡像
cp Copy files/folders between a container and the local filesystem 在宿主機器和container之間傳遞文件和文件夾
exec Run a command in a running container 在一個運行中的container上執(zhí)行命令
images List images 列出所有的鏡像
inspect Return low-level information on Docker objects 查看詳細docker各部件的詳細信息
kill Kill one or more running containers 停止一個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 羅列當前container的所有端口映射關系
ps List containers 顯示正在運行的container
pull Pull an image or a repository from a registry 從docker hub中獲取一個鏡像
push Push an image or a repository to a registry 發(fā)布一個鏡像到docker hub
rename Rename a container 重命名一個container
restart Restart one or more containers 重啟一個或者多個container
rm Remove one or more containers 移除一個或者多個container
rmi Remove one or more images 移除一個或多個鏡像
run Run a command in a new container 啟動一個新的container
start Start one or more stopped containers 啟動一個或多個container
stop Stop one or more running containers 停止一個或多個container
tag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE 從一個鏡像拷貝并重新命名為一個新的鏡像
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