安装docker后,可以使用命令行:
1
2
3 1docker help
2
3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81 1Usage: docker [OPTIONS] COMMAND
2
3A self-sufficient runtime for containers
4
5Options:
6 --config string Location of client config files (default
7 "C:\\Users\\Administrator\\.docker")
8 -D, --debug Enable debug mode
9 -H, --host list Daemon socket(s) to connect to
10 -l, --log-level string Set the logging level
11 ("debug"|"info"|"warn"|"error"|"fatal")
12 (default "info")
13 --tls Use TLS; implied by --tlsverify
14 --tlscacert string Trust certs signed only by this CA (default
15 "C:\\Users\\Administrator\\.docker\\ca.pem")
16 --tlscert string Path to TLS certificate file (default
17 "C:\\Users\\Administrator\\.docker\\cert.pem")
18 --tlskey string Path to TLS key file (default
19 "C:\\Users\\Administrator\\.docker\\key.pem")
20 --tlsverify Use TLS and verify the remote
21 -v, --version Print version information and quit
22
23Management Commands:
24 builder Manage builds
25 config Manage Docker configs
26 container Manage containers
27 image Manage images
28 network Manage networks
29 node Manage Swarm nodes
30 plugin Manage plugins
31 secret Manage Docker secrets
32 service Manage services
33 stack Manage Docker stacks
34 swarm Manage Swarm
35 system Manage Docker
36 trust Manage trust on Docker images
37 volume Manage volumes
38
39Commands:
40 attach Attach local standard input, output, and error streams to a running container
41 build Build an image from a Dockerfile
42 commit Create a new image from a container's changes
43 cp Copy files/folders between a container and the local filesystem
44 create Create a new container
45 diff Inspect changes to files or directories on a container's filesystem
46 events Get real time events from the server
47 exec Run a command in a running container
48 export Export a container's filesystem as a tar archive
49 history Show the history of an image
50 images List images
51 import Import the contents from a tarball to create a filesystem image
52 info Display system-wide information
53 inspect Return low-level information on Docker objects
54 kill Kill one or more running containers
55 load Load an image from a tar archive or STDIN
56 login Log in to a Docker registry
57 logout Log out from a Docker registry
58 logs Fetch the logs of a container
59 pause Pause all processes within one or more containers
60 port List port mappings or a specific mapping for the container
61 ps List containers
62 pull Pull an image or a repository from a registry
63 push Push an image or a repository to a registry
64 rename Rename a container
65 restart Restart one or more containers
66 rm Remove one or more containers
67 rmi Remove one or more images
68 run Run a command in a new container
69 save Save one or more images to a tar archive (streamed to STDOUT by default)
70 search Search the Docker Hub for images
71 start Start one or more stopped containers
72 stats Display a live stream of container(s) resource usage statistics
73 stop Stop one or more running containers
74 tag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
75 top Display the running processes of a container
76 unpause Unpause all processes within one or more containers
77 update Update configuration of one or more containers
78 version Show the Docker version information
79 wait Block until one or more containers stop, then print their exit codes
80
81
基本命令
仓库相关操作
docker pull #从远程仓库拉取镜像到本地
docker push #推送本地镜像到远程仓库
docker search #在仓库搜索镜像
docker login #登录到官方仓库Docker Hub
docker logout #退出登录
镜像相关操作
docker build #从Dockerfile构建镜像
docker pull #同上
docker push #同上
docker history #显示镜像的历史信息
docker images #列出镜像
docker rmi #删除镜像
docker tag #给镜像打上tag标签
docker run #创建容器并启动容器
docker create #创建容器
docker commit #将修改后的容器生成镜像
docker load #从压缩包中加载镜像
docker import #从归档文件中创建镜像
docker save #将镜像保存到压缩文件
容器相关操作
docker attach #依附到一个正在运行的容器中
docker exec #进到正在运行的容器中执行命令
docker cp #在容器和本地系统间复制文件
docker update #将一个容器内所有的进程从暂停状态中恢复
docker ps #列出主机中的容器
docker port #查找一个nat到私有网口的公共口
docker top #查看一个容器中正在运行的进程信息
docker logs #查看日志文件
docker diff #检查容器内文件系统的修改
docker status #输出容器的资源使用统计信息
docker wait #阻塞直到容器终止
docker start #启动已创建的容器
docker pause #暂停运行中的容器
docker unpause #使暂停的容器恢复运行
docker stop #停止容器运行
docker rename #容器改名
docker restart #容器重启
docker kill #关闭运行中的容器
docker rm #删除容器
docker export #导出容器内容为tar包
docker run #同上
docker create #同上
docker commit #同上
其他基本命令
docker events #从服务端获取实时的事件
docker info #查看系统相关信息
docker inspect #显示Docker对象的具体配置信息,包括容器,镜像,网络等
docker version #输出Docker的版本信息
管理命令
docker container #容器管理
docker image #镜像管理
docker network #网络管理
docker node #节点管理
docker plugin #插件管理
docker secret #管理敏感数据及普通服务配置项
docker service #服务管理
docker stack #栈管理
docker swarm #集群管理
docker system #管理系统信息
docker volume #卷管理