Docker命令

docker version 查看docker版本信息
docker info 详细系统信息(镜像和容器数量)
docker —help 查看docker命令
docker images 查看所有镜像
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest d1165f221234 3 weeks ago 13.3kB
镜像仓库源 镜像标签 镜像ID 创建时间 镜像大小

1617175022268

[root@iZbp1i72h4fylrgcruv1r1Z ~]# docker images --help
Usage: docker images [OPTIONS] [REPOSITORY[:TAG]]
List images
Options:
-a, --all Show all images (default hides intermediate images) 显示所有
--digests Show digests
-f, --filter filter Filter output based on conditions provided 过滤
--format string Pretty-print images using a Go template
--no-trunc Don't truncate output
-q, --quiet Only show image IDs 只显示id

docker search mysql 搜索镜像
[root@iZbp1i72h4fylrgcruv1r1Z ~]# docker search mysql
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
mysql MySQL is a widely used, open-source relation… 10676 [OK]
mariadb MariaDB Server is a high performing open sou… 4010 [OK]
mysql/mysql-server Optimized MySQL Server Docker images. Create… 780 [OK]
percona Percona Server is a fork of the MySQL relati… 529 [OK]
centos/mysql-57-centos7 MySQL 5.7 SQL database server 87
mysql/mysql-cluster Experimental MySQL Cluster Docker images. Cr… 80
centurylink/mysql Image containing mysql. Optimized to be link… 59 [OK]
bitnami/mysql Bitnami MySQL Docker Image 50 [OK]
databack/mysql-backup Back up mysql databases to... anywhere! 42
deitch/mysql-backup REPLACED! Please use http://hub.docker.com/r… 41 [OK]
prom/mysqld-exporter 37 [OK]
tutum/mysql Base docker image to run a MySQL database se… 35
schickling/mysql-backup-s3 Backup MySQL to S3 (supports periodic backup… 29 [OK]
linuxserver/mysql A Mysql container, brought to you by LinuxSe… 27
centos/mysql-56-centos7 MySQL 5.6 SQL database server 20
circleci/mysql MySQL is a widely used, open-source relation… 20
mysql/mysql-router MySQL Router provides transparent routing be… 18
arey/mysql-client Run a MySQL client from a docker container 17 [OK]
fradelg/mysql-cron-backup MySQL/MariaDB database backup using cron tas… 12 [OK]
yloeffler/mysql-backup This image runs mysqldump to backup data usi… 7 [OK]
openshift/mysql-55-centos7 DEPRECATED: A Centos7 based MySQL v5.5 image… 6
devilbox/mysql Retagged MySQL, MariaDB and PerconaDB offici… 3
ansibleplaybookbundle/mysql-apb An APB which deploys RHSCL MySQL 2 [OK]
jelastic/mysql An image of the MySQL database server mainta… 1
widdpim/mysql-client Dockerized MySQL Client (5.7) including Curl… 1 [OK]
搜索stars5000以上的mysql
[root@iZbp1i72h4fylrgcruv1r1Z ~]# docker search mysql -f=STARS=5000
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
mysql MySQL is a widely used, open-source relation… 10676 [OK]
docker pull mysql 下载镜像
下载镜像(默认最新版本) docker pull mysql 等价于
docker pull docker.io/library/mysql:latest
[root@iZbp1i72h4fylrgcruv1r1Z ~]# docker pull mysql
Using default tag: latest
latest: Pulling from library/mysql
75646c2fb410: Pull complete # 分层下载 结合联合文件系统
878f3d947b10: Pull complete
1a2dd2f75b04: Pull complete
8faaceef2b94: Pull complete
b77c8c445ec2: Pull complete
074029aeaa5f: Pull complete
5a1122545c6c: Pull complete
6c95ccd00139: Pull complete
60a719448fdb: Pull complete
f31898a387a3: Pull complete
bcf402a978dc: Pull complete
cf0bc7da512e: Pull complete
Digest: sha256:c35eb76bbccfd0138c8c68ccb9b4cffe42c488a27f64ddc31a2b5f65aa93fce6 签名
Status: Downloaded newer image for mysql:latest
docker.io/library/mysql:latest 真实地址
指定版本 docker pull mysql:5.7
(版本要和官网对应)
[root@iZbp1i72h4fylrgcruv1r1Z ~]# docker pull mysql:5.7
5.7: Pulling from library/mysql
75646c2fb410: Already exists
878f3d947b10: Already exists
1a2dd2f75b04: Already exists
8faaceef2b94: Already exists
b77c8c445ec2: Already exists
074029aeaa5f: Already exists
5a1122545c6c: Already exists #已经存在的就不在下载了
0539e5d96e0a: Pull complete
5bf3befab801: Pull complete
a8ba39ab191f: Pull complete
d472d441f7e9: Pull complete
Digest: sha256:dce7f54b744d09e95525ff8c767c5ba1c6a5a54d04c208fa55e3052ded713453
Status: Downloaded newer image for mysql:5.7
docker.io/library/mysql:5.7

docker rmi -f 镜像ID 删除指定镜像 (可以通过空格 删除多个容器 docker rmi -f 镜像ID 镜像ID 镜像ID)

docker rmi -f $(docker images -aq) 递归删除所有镜像

[root@iZbp1i72h4fylrgcruv1r1Z ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql 5.7 cd0f0b1e283d 3 hours ago 449MB
mysql latest e646c6533b0b 3 hours ago 546MB
hello-world latest d1165f221234 3 weeks ago 13.3kB
[root@iZbp1i72h4fylrgcruv1r1Z ~]# docker rmi -f e646c6533b0b
Untagged: mysql:latest
Untagged: mysql@sha256:c35eb76bbccfd0138c8c68ccb9b4cffe42c488a27f64ddc31a2b5f65aa93fce6
Deleted: sha256:e646c6533b0bcb75743ea9b176a03012610b2df7072dc312bf5921d1fbc5149c
Deleted: sha256:65167f08b8a8dfac64a23b6b416c9ae1b50e0eec43727a4df8654ba1121a2a82
Deleted: sha256:1da921102b7e22586e21597284a1b4a6da9d4ff769b34cb2a0ecf38238e7f378
Deleted: sha256:64f88c01ccb2cd83b3604fec48898890b007fb72d7ca97f8931b3aeef0442da5
Deleted: sha256:bcb7715e41d1583aabc2fbb4483023c4ad16ba01a1031fe9b1a28ec2fab3c607
Deleted: sha256:729a120d8ee08d06c02dd57aea41072001cb42d44b7e20e6c9d739e18baeb25d
[root@iZbp1i72h4fylrgcruv1r1Z ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql 5.7 cd0f0b1e283d 3 hours ago 449MB
hello-world latest d1165f221234 3 weeks ago 13.3kB
[root@iZbp1i72h4fylrgcruv1r1Z ~]# docker rmi -f $(docker images -aq)
Untagged: mysql:5.7
Untagged: mysql@sha256:dce7f54b744d09e95525ff8c767c5ba1c6a5a54d04c208fa55e3052ded713453
Deleted: sha256:cd0f0b1e283d233c244996ebe85014ed694b9016abd352837d46e6a53866c271
Deleted: sha256:7b5c4aa11ad63dd1d69e531f1e9c5f1751e8dbf0a6d4d79f478b089e07ead818
Deleted: sha256:a2c758445e9e43724c9d96405f434ee10b4b4412a167120c870f22b3c7f8a6de
Deleted: sha256:ea82af15cfd1ce63ba7fbef92bf6cdc3dd1aef0e9796633ab565f74fb372f7de
Deleted: sha256:64f4f3261b61deedd215118971515e8fa5ba61c85d6279fa4b3c0eee1b2bf096
Deleted: sha256:9b5fe2cce556fb46ccde1cf0358fc22a3378a1dd20e525a34fd02957ee2cfce5
Deleted: sha256:2dfff1f3267fa4ce98ad0c08e2566a32678e8db4a5b8e1750aeb12196509fd7d
Deleted: sha256:7a718ab0925be444d88315dcb89bd6402aca90491c3f44e024fcce642bc1eb43
Deleted: sha256:f6d6e42a834bf91e5c71cc864e4ba498ab0c1a6462a40c3b4961b7280bd4ee48
Deleted: sha256:d90b24d60fdb91130a4aab53c5ccda49e2695550a854817d5c5b30d6932a3831
Deleted: sha256:365c08d1f99c6e8c2aa15a51e379efd071c54ee71dc5c506db8ae617e0338e06
Deleted: sha256:346fddbbb0ff19bdb026afb053df490c0c73981a8a985882cf8ee3d716735e87
Untagged: hello-world:latest
Untagged: hello-world@sha256:308866a43596e83578c7dfa15e27a73011bdd402185a84c5cd7f32a88b501a24
Deleted: sha256:d1165f2212346b2bab48cb01c1e39ee8ad1be46b87873d9ca7a4e434980a7726
[root@iZbp1i72h4fylrgcruv1r1Z ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
[root@iZbp1i72h4fylrgcruv1r1Z ~]#
docker pull centos 下载一个centos 镜像
docker run [可选参数] image

参数说明

—name 容器名字 用来区分容器 (mysql01、mysql02….)

-d 后台运行

-it 使用交互方式运行 进入容器查看内容

-p 指定容器端口 -p 8080

​ -p ip:主机端口:容器端口

​ -p 主机端口:容器端口(常用)

​ 容器端口

-p 随机指定端口

[root@iZbp1i72h4fylrgcruv1r1Z ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos latest 300e315adb2f 3 months ago 209MB
[root@iZbp1i72h4fylrgcruv1r1Z ~]# docker run -it centos /bin/bash
[root@bdb765607279 /]#
docker ps 列出所有运行的容器

-a 显示所有运行容器(正在运行+历史运行的)

docker ps -a -n=1 只显示最近的n个

-q 只显示编号

[root@iZbp1i72h4fylrgcruv1r1Z /]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@iZbp1i72h4fylrgcruv1r1Z /]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
bdb765607279 centos "/bin/bash" 3 minutes ago Exited (0) 2 minutes ago adoring_wilson
ababf1d40cb6 d1165f221234 "/hello" 5 days ago Exited (0) 5 days ago eloquent_engelbart
0c413ade8dbe d1165f221234 "/hello" 5 days ago Exited (0) 5 days ago laughing_albattani
[root@iZbp1i72h4fylrgcruv1r1Z /]# docker ps -a -n=1
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
bdb765607279 centos "/bin/bash" 5 minutes ago Exited (0) 3 minutes ago adoring_wilson
[root@iZbp1i72h4fylrgcruv1r1Z /]#
退出容器

exit 停止 并退出

ctrl + P+Q (要在大写模式下才可以) 退出不停止 docker attach 容器id 退出后再次进入

[root@iZbp1i72h4fylrgcruv1r1Z /]# docker run -it centos /bin/bash
[root@b2efdb64bde8 /]# ls
bin dev etc home lib lib64 lost+found media mnt opt proc root run sbin srv sys tmp usr var
[root@b2efdb64bde8 /]# [root@iZbp1i72h4fylrgcruv1r1Z /]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b2efdb64bde8 centos "/bin/bash" About a minute ago Up About a minute adoring_spence
[root@iZbp1i72h4fylrgcruv1r1Z /]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b2efdb64bde8 centos "/bin/bash" About a minute ago Up About a minute adoring_spence
bdb765607279 centos "/bin/bash" 10 minutes ago Exited (0) 8 minutes ago adoring_wilson
ababf1d40cb6 d1165f221234 "/hello" 5 days ago Exited (0) 5 days ago eloquent_engelbart
0c413ade8dbe d1165f221234 "/hello" 5 days ago Exited (0) 5 days ago laughing_albattani
[root@iZbp1i72h4fylrgcruv1r1Z /]# docker attach b2efdb64bde8
[root@b2efdb64bde8 /]# exit
exit
[root@iZbp1i72h4fylrgcruv1r1Z /]#
删除容器

docker rm 容器id

docker rm -f 容器id (强制删除)

docker rm -f $(docker ps -aq) 递归删除所有容器

docker ps -a -q|xargs docker rm 删除所有容器

[root@iZbp1i72h4fylrgcruv1r1Z /]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b2efdb64bde8 centos "/bin/bash" 3 minutes ago Exited (0) 57 seconds ago adoring_spence
bdb765607279 centos "/bin/bash" 12 minutes ago Exited (0) 10 minutes ago adoring_wilson
ababf1d40cb6 d1165f221234 "/hello" 5 days ago Exited (0) 5 days ago eloquent_engelbart
0c413ade8dbe d1165f221234 "/hello" 5 days ago Exited (0) 5 days ago laughing_albattani
[root@iZbp1i72h4fylrgcruv1r1Z /]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@iZbp1i72h4fylrgcruv1r1Z /]# docker rm bdb765607279
bdb765607279
[root@iZbp1i72h4fylrgcruv1r1Z /]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@iZbp1i72h4fylrgcruv1r1Z /]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b2efdb64bde8 centos "/bin/bash" 4 minutes ago Exited (0) 2 minutes ago adoring_spence
ababf1d40cb6 d1165f221234 "/hello" 5 days ago Exited (0) 5 days ago eloquent_engelbart
0c413ade8dbe d1165f221234 "/hello" 5 days ago Exited (0) 5 days ago laughing_albattani
[root@iZbp1i72h4fylrgcruv1r1Z /]# docker rm -f $(docker ps -aq)
b2efdb64bde8
ababf1d40cb6
0c413ade8dbe
[root@iZbp1i72h4fylrgcruv1r1Z /]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@iZbp1i72h4fylrgcruv1r1Z /]#
启动和停止容器

docker start 容器id 启动容器

docker restart 容器id 重启容器

docker stop 容器id 退出容器

docker kill 容器id 强制退出容器

后台运行容器

docker run -d 镜像名

启动后发现立刻停止掉了

docker 容器使用后台运行 ,就必须有一个前台进程 docker发现没用应用会立刻停止

[root@iZbp1i72h4fylrgcruv1r1Z /]# docker run -d centos
fe42c32e3e423519c24c0f71a641a66202cc4cd977fd40d29581cd0241791c71
[root@iZbp1i72h4fylrgcruv1r1Z /]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@iZbp1i72h4fylrgcruv1r1Z /]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
fe42c32e3e42 centos "/bin/bash" 7 seconds ago Exited (0) 6 seconds ago friendly_shamir
[root@iZbp1i72h4fylrgcruv1r1Z /]#

显示日志

-tf

—tail num (num 要显示的日志条数)

docker logs -tf --tail 10 容器id 显示指定行数的日志
docker logs -tf 容器id 显示所有日志
docker top 容器id 显示进程信息
[root@iZbp1i72h4fylrgcruv1r1Z /]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f15395ad843c centos "/bin/bash" 44 seconds ago Up 44 seconds inspiring_jones
[root@iZbp1i72h4fylrgcruv1r1Z /]# docker top f15395ad843c
UID PID PPID C STIME TTY TIME CMD
root 26158 26138 0 16:20 pts/0 00:00:00 /bin/bash
[root@iZbp1i72h4fylrgcruv1r1Z /]#
查看镜像元数据

docker inspect

[root@iZbp1i72h4fylrgcruv1r1Z /]# docker inspect --help
Usage: docker inspect [OPTIONS] NAME|ID [NAME|ID...]
Return low-level information on Docker objects
Options:
-f, --format string Format the output using the given Go template
-s, --size Display total file sizes if the type is container
--type string Return JSON for specified type
[root@iZbp1i72h4fylrgcruv1r1Z /]# docker inspect f15395ad843c
[
{
"Id": "f15395ad843c546a86105bf2438e24e936f3d771e20a45f427cf1306bb898146",
"Created": "2021-03-31T08:20:44.404832318Z",
"Path": "/bin/bash",
"Args": [],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 26158,
"ExitCode": 0,
"Error": "",
"StartedAt": "2021-03-31T08:20:44.742836365Z",
"FinishedAt": "0001-01-01T00:00:00Z"
},
"Image": "sha256:300e315adb2f96afe5f0b2780b87f28ae95231fe3bdd1e16b9ba606307728f55",
"ResolvConfPath": "/var/lib/docker/containers/f15395ad843c546a86105bf2438e24e936f3d771e20a45f427cf1306bb898146/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/f15395ad843c546a86105bf2438e24e936f3d771e20a45f427cf1306bb898146/hostname",
"HostsPath": "/var/lib/docker/containers/f15395ad843c546a86105bf2438e24e936f3d771e20a45f427cf1306bb898146/hosts",
"LogPath": "/var/lib/docker/containers/f15395ad843c546a86105bf2438e24e936f3d771e20a45f427cf1306bb898146/f15395ad843c546a86105bf2438e24e936f3d771e20a45f427cf1306bb898146-json.log",
"Name": "/inspiring_jones",
"RestartCount": 0,
"Driver": "overlay2",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": null,
"HostConfig": {
"Binds": null,
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "default",
"PortBindings": {},
"RestartPolicy": {
"Name": "no",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": null,
"CapAdd": null,
"CapDrop": null,
"CgroupnsMode": "host",
"Dns": [],
"DnsOptions": [],
"DnsSearch": [],
"ExtraHosts": null,
"GroupAdd": null,
"IpcMode": "private",
"Cgroup": "",
"Links": null,
"OomScoreAdj": 0,
"PidMode": "",
"Privileged": false,
"PublishAllPorts": false,
"ReadonlyRootfs": false,
"SecurityOpt": null,
"UTSMode": "",
"UsernsMode": "",
"ShmSize": 67108864,
"Runtime": "runc",
"ConsoleSize": [
0,
0
],
"Isolation": "",
"CpuShares": 0,
"Memory": 0,
"NanoCpus": 0,
"CgroupParent": "",
"BlkioWeight": 0,
"BlkioWeightDevice": [],
"BlkioDeviceReadBps": null,
"BlkioDeviceWriteBps": null,
"BlkioDeviceReadIOps": null,
"BlkioDeviceWriteIOps": null,
"CpuPeriod": 0,
"CpuQuota": 0,
"CpuRealtimePeriod": 0,
"CpuRealtimeRuntime": 0,
"CpusetCpus": "",
"CpusetMems": "",
"Devices": [],
"DeviceCgroupRules": null,
"DeviceRequests": null,
"KernelMemory": 0,
"KernelMemoryTCP": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": null,
"OomKillDisable": false,
"PidsLimit": null,
"Ulimits": null,
"CpuCount": 0,
"CpuPercent": 0,
"IOMaximumIOps": 0,
"IOMaximumBandwidth": 0,
"MaskedPaths": [
"/proc/asound",
"/proc/acpi",
"/proc/kcore",
"/proc/keys",
"/proc/latency_stats",
"/proc/timer_list",
"/proc/timer_stats",
"/proc/sched_debug",
"/proc/scsi",
"/sys/firmware"
],
"ReadonlyPaths": [
"/proc/bus",
"/proc/fs",
"/proc/irq",
"/proc/sys",
"/proc/sysrq-trigger"
]
},
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/bfd6c0c6a9321df6e8eb1ddaa1a04ecfae7a4742f53f7e99ee11b30d0b012880-init/diff:/var/lib/docker/overlay2/1280753fb974c510807a93b7835cb070448d2a86632d48a65074cee043b91689/diff",
"MergedDir": "/var/lib/docker/overlay2/bfd6c0c6a9321df6e8eb1ddaa1a04ecfae7a4742f53f7e99ee11b30d0b012880/merged",
"UpperDir": "/var/lib/docker/overlay2/bfd6c0c6a9321df6e8eb1ddaa1a04ecfae7a4742f53f7e99ee11b30d0b012880/diff",
"WorkDir": "/var/lib/docker/overlay2/bfd6c0c6a9321df6e8eb1ddaa1a04ecfae7a4742f53f7e99ee11b30d0b012880/work"
},
"Name": "overlay2"
},
"Mounts": [],
"Config": {
"Hostname": "f15395ad843c",
"Domainname": "",
"User": "",
"AttachStdin": true,
"AttachStdout": true,
"AttachStderr": true,
"Tty": true,
"OpenStdin": true,
"StdinOnce": true,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Cmd": [
"/bin/bash"
],
"Image": "centos",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": {
"org.label-schema.build-date": "20201204",
"org.label-schema.license": "GPLv2",
"org.label-schema.name": "CentOS Base Image",
"org.label-schema.schema-version": "1.0",
"org.label-schema.vendor": "CentOS"
}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "2742bb92f5dbbc521d588806ea1196c12986e77f50a065192b25e95a6859ad21",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {},
"SandboxKey": "/var/run/docker/netns/2742bb92f5db",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "bc9d1dd166b97a9d67e9abffecb1cc5ff54f39708606c82aaa74fc8c9cf21334",
"Gateway": "172.17.0.1",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"MacAddress": "02:42:ac:11:00:02",
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "1e420550944ec65231053e70df2afc2a068fa5452b455296d3f8c8260b3a2324",
"EndpointID": "bc9d1dd166b97a9d67e9abffecb1cc5ff54f39708606c82aaa74fc8c9cf21334",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:11:00:02",
"DriverOpts": null
}
}
}
}
]
[root@iZbp1i72h4fylrgcruv1r1Z /]#

 

进入正在运行的容器
docker exec -it 容器id (进入一个新的终端)
[root@iZbp1i72h4fylrgcruv1r1Z /]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f15395ad843c centos "/bin/bash" 5 minutes ago Up 5 minutes inspiring_jones
[root@iZbp1i72h4fylrgcruv1r1Z /]# docker exec -it f15395ad843c /bin/bash
docker attach 容器id /bin/bash (进入正在运行的终端)
posted @ 2021-04-05 21:28  IT搬砖者  阅读(228)  评论(0编辑  收藏  举报