Docker的常用命令简介
程序员文章站
2022-03-12 11:57:33
...
页内导航
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上执行命令
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 发布一个镜像到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
系列文章
上一篇: python中spyder怎么安装
下一篇: K8S实战(三)| Pod 的本质