(1)attach Attach to a running container #当前shell下attach连接指定运行镜像 (这个命令启动后从容器中退出会关闭容器,使用ctrl+p+q退出容器,容器仍会运行)
root@lab01:/# docker rmi hello-world
Untagged: hello-world:latest
Untagged: hello-world@sha256:df5f5184104426b65967e016ff2ac0bfcd44ad7899ca3bbcf8e44e4461491a9e
Deleted: sha256:d1165f2212346b2bab48cb01c1e39ee8ad1be46b87873d9ca7a4e434980a7726
Deleted: sha256:f22b99068db93900abe17f7f5e09ec775c2826ecfe9db961fea68293744144bd
(2)build Build an image from a Dockerfile #通过Dockerfile定制镜像
(3)commit Create a new image from a containers changes #提交当前容器为新的镜像
(4)cp Copy files/folders from a container to a HOSTDIR or to STDOUT #从容器中拷贝指定文件或者目录到宿主机中
(5)create Create a new container #创建一个新的容器,同run 但不启动容器
(6)diff Inspect changes on a containers filesystem #查看docker容器变化
(7)events Get real time events from the server#从docker服务获取容器实时事件
(8)exec Run a command in a running container#在已存在的容器上运行命令(此启动方式退出后容器不会停止)
root@lab01:/# docker exec -it b3c05724e2cc /bin/bash
[root@b3c05724e2cc /]# exit
exit
root@lab01:/# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b3c05724e2cc centos "/bin/bash" 6 minutes ago Up About a minute
(9)export Export a containers filesystem as a tar archive #导出容器的内容流作为一个tar归档文件(对应import)
(10)history Show the history of an image #展示一个镜像形成历史
(11)images List images #列出系统当前镜像
root@lab01:/# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest d1165f221234 5 months ago 13.3kB
centos latest 300e315adb2f 7 months ago 209MB
(12)import Import the contents from a tarball to create a filesystem image #从tar包中的内容创建一个新的文件系统映像(对应export)
(13)info Display system-wide information #显示系统相关信息
root@lab01:/# docker info
Containers: 1
Running: 1
Paused: 0
Stopped: 0
Images: 1
Server Version: 20.10.7
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
Default Runtime: runc
Init Binary: docker-init
containerd version: e25210fe30a0a703442421b0f60afac609f950a3
runc version: v1.0.1-0-g4144b63
init version: fec3683 (expected: de40ad0)
Security Options:
apparmor
seccomp
Profile: default
Kern