Docker常用命令
帮助命令
docker version #显示docker版本信息
docker info #显示dicker的系统信息 包括镜像和容器的数量
dockers 命令 --help #帮助命令
帮助文档的地址 https://docs.docker.com/engine/reference/commandline
镜像命令
docker images 查看所有本地主机上上的镜像
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest bf756fb1ae65 7 months ago 13.3kB
#解释
repository #镜像的仓库源
tag #镜像的标签
image ID #镜像的ID
created #镜像的创建时间
size #镜像的大小
#可选项
-a, --all #列出所有镜像
-q, --quiet #只显示镜像的ID
docker search 搜索镜像
[root@localhost ~]# docker search mysql
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
mysql MySQL is a widely used, open-source relation… 9822 [OK]
mariadb MariaDB is a community-developed fork of MyS… 3585 [OK]
mysql/mysql-server Optimized MySQL Server Docker images. Create… 719 [OK]
percona Percona Server is a fork of the MySQL relati… 499 [OK]
centos/mysql-57-centos7 MySQL 5.7 SQL database server 80
mysql/mysql-cluster Experimental MySQL Cluster Docker images. Cr… 74
centurylink/mysql Image containing mysql. Optimized to be link… 61 [OK]
bitnami/mysql Bitnami MySQL Docker Image 44 [OK]
deitch/mysql-backup REPLACED! Please use http://hub.docker.com/r… 41 [OK]
tutum/mysql Base docker image to run a MySQL database se… 35
#可选项,通过收藏来过滤
--filter=stars=3000 #搜索出来的镜像就是收藏数大于3000的
[root@localhost ~]# docker search mysql
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
mysql MySQL is a widely used, open-source relation… 9822 [OK]
mariadb MariaDB is a community-developed fork of MyS… 3585 [OK]
mysql/mysql-server Optimized MySQL Server Docker images. Create… 719 [OK]
docker pull 下载镜像
#下载镜像 docker pull 镜像名[:tag]
[root@localhost ~]# docker pull mysql
Using default tag: latest #如果不写tag,默认latest
latest: Pulling from library/mysql
bf5952930446: Pull complete #分层下载,dockersimage的核心,联合文件系统
8254623a9871: Pull complete
938e3e06dac4: Pull complete
ea28ebf28884: Pull complete
f3cef38785c2: Pull complete
894f9792565a: Pull complete
1d8a57523420: Pull complete
6c676912929f: Pull complete
ff39fdb566b4: Pull complete
fff872988aba: Pull complete
4d34e365ae68: Pull complete
7886ee20621e: Pull complete
Digest: sha256:c358e72e100ab493a0304bda35e6f239db2ec8c9bb836d8a427ac34307d074ed #签名
Status: Downloaded newer image for mysql:latest
docker.io/library/mysql:latest #真实地址
#等价于它
docker pull mysql
docker pull docker.io/library/mysql:latest
#指定版本下载
[root@localhost ~]# docker pull mysql:5.7
5.7: Pulling from library/mysql
bf5952930446: Already exists
8254623a9871: Already exists
938e3e06dac4: Already exists
ea28ebf28884: Already exists
f3cef38785c2: Already exists
894f9792565a: Already exists
1d8a57523420: Already exists
5f09bf1d31c1: Pull complete
1b6ff254abe7: Pull complete
74310a0bf42d: Pull complete
d398726627fd: Pull complete
Digest: sha256:da58f943b94721d46e87d5de208dc07302a8b13e638cd1d24285d222376d6d84
Status: Downloaded newer image for mysql:5.7
docker.io/library/mysql:5.7
docker rmi 删除镜像
# docker rmi -f 容器id 删除指定的容器
# docker rmi -f 容器id 容器id 容器id 删除多个容器
# docker rmi -f $(docker images -aq) 删除全部的容器
[root@localhost ~]# docker rmi -f 718a6da099d8
Untagged: mysql:5.7
Untagged: mysql@sha256:da58f943b94721d46e87d5de208dc07302a8b13e638cd1d24285d222376d6d84
Deleted: sha256:718a6da099d82183c064a964523c0deca80619cb033aadd15854771fe592a480
Deleted: sha256:058d93ef2bfb943ba6a19d8b679c702be96e34337901da9e1a07ad62b772bf3d
Deleted: sha256:7bca77783fcf15499a0386127dd7d5c679328a21b6566c8be861ba424ac13e49
Deleted: sha256:183d05512fa88dfa8c17abb9b6f09a79922d9e9ee001a33ef34d1bc094bf8f9f
Deleted: sha256:165805124136fdee738ed19021a522bb53de75c2ca9b6ca87076f51c27385fd7
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql latest 0d64f46acfd1 5 days ago 544MB
hello-world latest bf756fb1ae65 7 months ago 13.3kB
[root@localhost ~]# docker rmi -f $(docker images -aq)
Untagged: mysql:latest
Untagged: mysql@sha256:c358e72e100ab493a0304bda35e6f239db2ec8c9bb836d8a427ac34307d074ed
Deleted: sha256:0d64f46acfd1af4ee6a162f80c6e07e843761bf14d412060023bf0e69e720fb4
Deleted: sha256:308fb4d64e5d57094fcd70bd946f9f842a1de6b596a4807787f01dc181c76b18
Deleted: sha256:fbc8e9508f704f46bfe3607ce4523aac7758757a9752a44a40221c2d353b7147
Deleted: sha256:d55db5e278c81c9cf5b51cc63f5ba9c5d9a616f6e28f9ce25b3545ff58298a89
Deleted: sha256:c2596316288a83e50e7e922d18b5f86b8ce34915c6f58c239f093cb514016538
Deleted: sha256:cfe5cd376e0ee9cb83864690a8971646a774ed189bda11f5a39e8bb0e71d77f9
Deleted: sha256:904abdc2d0bea0edbb1a8171d1a1353fa6de22150a9c5d81358799a5b6c38c8d
Deleted: sha256:d26f7649f78cf789267fbbca8aeb234932e230109c728632c6b9fbc60ca5591b
Deleted: sha256:7fcf7796e23ea5b42eb3bbd5bec160ba5f5f47ecb239053762f9cf766c143942
Deleted: sha256:826130797a5760bcd2bb19a6c6d92b5f4860bbffbfa954f5d3fc627904a76e9d
Deleted: sha256:53e0181c63e41fb85bce681ec8aadfa323cd00f70509107f7001a1d0614e5adf
Deleted: sha256:d6854b83e83d7eb48fb0ef778c58a8b839adb932dd036a085d94a7c2db98f890
Deleted: sha256:d0f104dc0a1f9c744b65b23b3fd4d4d3236b4656e67f776fe13f8ad8423b955c
Untagged: hello-world:latest
Untagged: hello-world@sha256:49a1c8800c94df04e9658809b006fd8a686cab8028d33cfba2cc049724254202
Deleted: sha256:bf756fb1ae65adf866bd8c456593cd24beb6a0a061dedf42b26a993176745f6b
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
[root@localhost ~]#
容器命令
说明:有了镜像才可以创建容器,linux,下载一个centos镜像来测试学习
docker pull centos
新建容器并启动
docker run [可选参数] image
# 参数说明
--name="Name" 容器名字 tomcat01 tomcat02,用来区分容器
-d 后台方式运行
-it 使用交互方式运行,进入容器查看内容
-p 指定容器的端口 -p 8080:8080
-p ip:主机端口:容器端口
-p 主机端口:容器端口(常用)
-p 容器端口
容器端口 (省略-p)
-p 指定随机端口
#测试 启动并进入容器
[root@localhost ~]# docker run -it centos /bin/bash
[root@3723a4540fe2 /]# ls #查看容器内的centos,基础版本,很多命令都是不完善的
bin dev etc home lib lib64 lost+found media mnt opt proc root run sbin srv sys tmp usr var
#从容器中退回主机
[root@3723a4540fe2 /]# exit
exit
[root@localhost /]# ls
bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
列出所有运行的容器
# docker ps 命令
#列出当前正在运行的容器
-a #列出当前正在运行的容器+待处理是运行过的容器
-n=? #显示最近创建的容器
-q #只显示容器的编号
[root@localhost /]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@localhost /]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3723a4540fe2 centos "/bin/bash" 4 minutes ago Exited (0) 2 minutes ago gracious_wiles
8bc158de79da bf756fb1ae65 "/hello" 13 hours ago Exited (0) 13 hours ago gallant_ritchie
[root@localhost /]# docker ps -n=1
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3723a4540fe2 centos "/bin/bash" 8 minutes ago Exited (0) 6 minutes ago gracious_wiles
[root@localhost /]# docker ps -a -n=1
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3723a4540fe2 centos "/bin/bash" 8 minutes ago Exited (0) 6 minutes ago gracious_wiles
[root@localhost /]# docker ps -aq
3723a4540fe2
8bc158de79da
退出容器
exit #直接容器停止并退出
CTRL + P + Q #容器不停止退出
[root@localhost /]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@localhost /]# docker run -it centos /bin/bash
[root@b38d04803e1c /]#
[root@b38d04803e1c /]# [root@localhost /]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b38d04803e1c centos "/bin/bash" About a minute ago Up About a minute interesting_lumiere
[root@localhost /]#
删除容器
docker rm 容器id #删除指定的容器,不能删除正在运行的容器,如果要强制删除 rm -f
docker rm -f $(docker ps -aq) #查询出所有容器递归删除
docker ps -a -q|xargs docker rm #删除所有容器
[root@localhost /]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b38d04803e1c centos "/bin/bash" 5 minutes ago Up 5 minutes interesting_lumiere
3723a4540fe2 centos "/bin/bash" 17 minutes ago Exited (0) 15 minutes ago gracious_wiles
8bc158de79da bf756fb1ae65 "/hello" 13 hours ago Exited (0) 13 hours ago gallant_ritchie
[root@localhost /]# docker rm 3723a4540fe2
3723a4540fe2
[root@localhost /]# docker rm b38d04803e1c
Error response from daemon: You cannot remove a running container b38d04803e1c6f969c499b0bebb6642f1e9c33a19451831c57d703ddbd67b43d. Stop the container before attempting removal or force remove
[root@localhost /]# docker ps -aq
b38d04803e1c
8bc158de79da
[root@localhost /]# docker rm -f $(docker ps -aq)
b38d04803e1c
8bc158de79da
[root@localhost /]# docker ps -aq
[root@localhost /]#
启动和停止容器的操作
docker start 容器id #启动容器
docker restart 容器id #重启容器
docker stop 容器id #停止当前正在运行的容器
docker kill 容器id #强制停止容器
常用其他命令
后台启动容器
# 命令 docker run -d 镜像名
[root@localhost /]# docker run -d centos
5cb1b0f49ddbdb92fb836667474e8160397088fe418f96027644533993928d63
[root@localhost /]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
#问题docker ps 发现centos停止了
#常见的坑: docker 容器使用后台运行 ,就必须要有一个前台进程,docker发现没有应用,就会自动停止
#nginx,容器启动运行后,发现自己没有提供服务,就会立刻停止,就是没有程序了
查看日志命令
docker logs -f -t --tail 容器id
1 # 自己编写一段shell脚本
"while true;do echo ukatta;sleep 1;done"
[root@localhost /]# docker run -d centos /bin/sh -c "while true;do echo ukatta;sleep 1;done"
46b9f46b0cb9632ba3d31f1fba3832b279f0da66b250ef5cc478720fccfc9027
2 # docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
46b9f46b0cb9 centos "/bin/sh -c 'while t…" 3 seconds ago Up 2 seconds stoic_gauss
3 # 显示日志
-tf (-t -f) #显示日志
--tail number #要显示的日志条数
[root@localhost /]# docker logs -f -t --tail 10 46b9f46b0cb9
2020-08-10T16:31:02.694094825Z ukatta
2020-08-10T16:31:03.697914023Z ukatta
2020-08-10T16:31:04.701620196Z ukatta
2020-08-10T16:31:05.706329262Z ukatta
2020-08-10T16:31:06.710512451Z ukatta
2020-08-10T16:31:07.715366158Z ukatta
2020-08-10T16:31:08.719275054Z ukatta
2020-08-10T16:31:09.724028301Z ukatta
2020-08-10T16:31:10.728049838Z ukatta
2020-08-10T16:31:11.733024373Z ukatta
2020-08-10T16:31:12.738052615Z ukatta
查看容器中的进程信息
# 命令 docker top 容器id
[root@localhost /]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
46b9f46b0cb9 centos "/bin/sh -c 'while t…" 6 minutes ago Up 6 minutes stoic_gauss
[root@localhost /]# docker top 46b9f46b0cb9
UID PID PPID C STIME TTY TIME CMD
root 3489 3474 0 00:28 ? 00:00:00 /bin/sh -c while true;do echo ukatta;sleep 1;done
root 3968 3489 0 00:34 ? 00:00:00 /usr/bin/coreutils --coreutils-prog-shebang=sleep /usr/bin/sleep 1
[root@localhost /]#
查看镜像的元数据
#命令 docker inspect 容器id
#测试
[root@localhost /]# 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@localhost /]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
46b9f46b0cb9 centos "/bin/sh -c 'while t…" 8 minutes ago Up 8 minutes stoic_gauss
08d04ff9a17e centos "/bin/sh -c 'while t…" 10 minutes ago Exited (1) 10 minutes ago reverent_lamarr
dccd2773b7b0 centos "/bin/sh 'while true…" 11 minutes ago Exited (127) 11 minutes ago friendly_bouman
07a0ab1f976e centos "/bin/sh -C 'while t…" 12 minutes ago Exited (127) 12 minutes ago naughty_dhawan
4cfdf435b052 centos "/bin/bash" 13 minutes ago Exited (0) 13 minutes ago vigilant_wu
07a425d1b346 centos "/bin/bash" 20 minutes ago Exited (127) 12 minutes ago focused_borg
5cb1b0f49ddb centos "/bin/bash" 27 minutes ago Exited (0) 27 minutes ago infallible_pare
003d92699c08 centos "/bin/bash" 29 minutes ago Exited (0) 28 minutes ago competent_neumann
[root@localhost /]# docker inspect 46b9f46b0cb9
[
{
"Id": "46b9f46b0cb9632ba3d31f1fba3832b279f0da66b250ef5cc478720fccfc9027",
"Created": "2020-08-10T16:28:16.757267998Z",
"Path": "/bin/sh",
"Args": [
"-c",
"while true;do echo ukatta;sleep 1;done"
],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 3489,
"ExitCode": 0,
"Error": "",
"StartedAt": "2020-08-10T16:28:17.041087926Z",
"FinishedAt": "0001-01-01T00:00:00Z"
},
"Image": "sha256:831691599b88ad6cc2a4abbd0e89661a121aff14cfa289ad840fd3946f274f1f",
"ResolvConfPath": "/var/lib/docker/containers/46b9f46b0cb9632ba3d31f1fba3832b279f0da66b250ef5cc478720fccfc9027/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/46b9f46b0cb9632ba3d31f1fba3832b279f0da66b250ef5cc478720fccfc9027/hostname",
"HostsPath": "/var/lib/docker/containers/46b9f46b0cb9632ba3d31f1fba3832b279f0da66b250ef5cc478720fccfc9027/hosts",
"LogPath": "/var/lib/docker/containers/46b9f46b0cb9632ba3d31f1fba3832b279f0da66b250ef5cc478720fccfc9027/46b9f46b0cb9632ba3d31f1fba3832b279f0da66b250ef5cc478720fccfc9027-json.log",
"Name": "/stoic_gauss",
"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,
"Capabilities": null,
"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/d733fe3d5172f0e6122e072e97bd9456634ff082e247fd6b3a3a3f04758164cd-init/diff:/var/lib/docker/overlay2/e742792e7629b9783e405c5fa8e6190d4d9e83198c6f522e1143cd80fe7638f3/diff",
"MergedDir": "/var/lib/docker/overlay2/d733fe3d5172f0e6122e072e97bd9456634ff082e247fd6b3a3a3f04758164cd/merged",
"UpperDir": "/var/lib/docker/overlay2/d733fe3d5172f0e6122e072e97bd9456634ff082e247fd6b3a3a3f04758164cd/diff",
"WorkDir": "/var/lib/docker/overlay2/d733fe3d5172f0e6122e072e97bd9456634ff082e247fd6b3a3a3f04758164cd/work"
},
"Name": "overlay2"
},
"Mounts": [],
"Config": {
"Hostname": "46b9f46b0cb9",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Cmd": [
"/bin/sh",
"-c",
"while true;do echo ukatta;sleep 1;done"
],
"Image": "centos",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": {
"org.label-schema.build-date": "20200611",
"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": "ec86f6411ee39a14424be5c2a8b7ccc7287ffa65e259c3ab582f7dab7b28a720",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {},
"SandboxKey": "/var/run/docker/netns/ec86f6411ee3",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "d351ba2353ee5c7bc348027aefb7b4bc2ae1f4e0ca7b3a0cc19ba1e77109aa1f",
"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": "729f99ab118f3fbfb100456e1ba7ec6b5d305d61d37835bd065f3e03959b3e51",
"EndpointID": "d351ba2353ee5c7bc348027aefb7b4bc2ae1f4e0ca7b3a0cc19ba1e77109aa1f",
"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@localhost /]#
**进入当前正在运行的容器 **
#我们通常容器都是通过后台方式运行的,需要进入容器,修改一些配置
# 命令
docker exec -it 容器id bash或者shell
#测试
[root@localhost /]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
46b9f46b0cb9 centos "/bin/sh -c 'while t…" 17 minutes ago Up 17 minutes stoic_gauss
[root@localhost /]# docker exec -it 46b9f46b0cb9 /bin/bash
[root@46b9f46b0cb9 /]# ls
bin etc lib lost+found mnt proc run srv tmp var
dev home lib64 media opt root sbin sys usr
[root@46b9f46b0cb9 /]# ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 16:28 ? 00:00:00 /bin/sh -c while true;do echo ukatta;sleep 1;done
root 1105 0 0 16:46 pts/0 00:00:00 /bin/bash
root 1133 1 0 16:46 ? 00:00:00 /usr/bin/coreutils --coreutils-prog-shebang=sleep /usr/b
root 1134 1105 0 16:
#方式二
docker attach 容器id
#测试
[root@localhost /]# docker attach 46b9f46b0cb9
ukatta
ukatta
ukatta
ukatta
ukatta
ukatta
ukatta
ukatta
ukatta
ukatta
正在执行的代码......
# docker exec #进入容器后开启一个新的终端,可以在里面操作(常用)
# docker attach # 进入容器正在执行的终端,不会启动新的进程!
从容器内拷贝文件到主机上
docker cp 容器id:容器内路径 目的主机路径和
#测试
[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@localhost ~]# docker run -it centos /bin/bash
[root@c7a1842f4263 /]# [root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c7a1842f4263 centos "/bin/bash" 13 seconds ago Up 12 seconds fervent_franklin
[root@localhost ~]# cd /home
#查看当前目录主机下
[root@localhost home]# ls
jjl
[root@localhost home]# touch ukatta.java
[root@localhost home]# ls
jjl ukatta.java
#进入docker容器
[root@localhost home]# docker attach c7a1842f4263
[root@c7a1842f4263 /]# cd /home
[root@c7a1842f4263 home]# ls
#在容器内新建一个文件 test.java
[root@c7a1842f4263 home]# touch test.java
[root@c7a1842f4263 home]# exit
exit
[root@localhost home]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c7a1842f4263 centos "/bin/bash" 2 minutes ago Exited (0) 5 seconds ago fervent_franklin
[root@localhost home]# docker ps c7a1842f4263:/home/test.java /home
"docker ps" accepts no arguments.
See 'docker ps --help'.
Usage: docker ps [OPTIONS]
List containers
# 将这个文件拷贝到主机上
[root@localhost home]# docker cp c7a1842f4263:/home/test.java /home
[root@localhost home]# ls
jjl test.java ukatta.java
[root@localhost home]#
# 拷贝是一个手动技术 未来我们使用 -v卷的技术 ,可以实现,自动同步 /home /home
作业练习
Docker安装nginx
# 1 搜索镜像 search 建议大家去docker hub 搜索,可以看到帮助文档
# 2 下载镜像 pull
# 3 运行测试
[root@localhost ~]# docker search nginx
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
nginx Official build of Nginx. 13590 [OK]
jwilder/nginx-proxy Automated Nginx reverse proxy for docker con… 1857 [OK]
richarvey/nginx-php-fpm Container running Nginx + PHP-FPM capable of… 782 [OK]
linuxserver/nginx An Nginx container, brought to you by LinuxS… 126
bitnami/nginx Bitnami nginx Docker Image 88 [OK]
tiangolo/nginx-rtmp Docker image with Nginx using the nginx-rtmp… 87 [OK]
jc21/nginx-proxy-manager Docker container for managing Nginx proxy ho… 77
alfg/nginx-rtmp NGINX, nginx-rtmp-module and FFmpeg from sou… 72 [OK]
nginxdemos/hello NGINX webserver that serves a simple page co… 59 [OK]
jlesage/nginx-proxy-manager Docker container for Nginx Proxy Manager 53 [OK]
nginx/nginx-ingress NGINX Ingress Controller for Kubernetes 37
privatebin/nginx-fpm-alpine PrivateBin running on an Nginx, php-fpm & Al… 31 [OK]
schmunk42/nginx-redirect A very simple container to redirect HTTP tra… 19 [OK]
nginxinc/nginx-unprivileged Unprivileged NGINX Dockerfiles 17
nginx/nginx-prometheus-exporter NGINX Prometheus Exporter 14
centos/nginx-18-centos7 Platform for running nginx 1.8 or building n… 13
raulr/nginx-wordpress Nginx front-end for the official wordpress:f… 13 [OK]
centos/nginx-112-centos7 Platform for running nginx 1.12 or building … 13
mailu/nginx Mailu nginx frontend 7 [OK]
sophos/nginx-vts-exporter Simple server that scrapes Nginx vts stats a… 7 [OK]
bitwarden/nginx The Bitwarden nginx web server acting as a r… 7
bitnami/nginx-ingress-controller Bitnami Docker Image for NGINX Ingress Contr… 6 [OK]
flashspys/nginx-static Super Lightweight Nginx Image 6 [OK]
wodby/nginx Generic nginx 1 [OK]
ansibleplaybookbundle/nginx-apb An APB to deploy NGINX 1 [OK]
[root@localhost ~]# docker pull nginx
Using default tag: latest
latest: Pulling from library/nginx
bf5952930446: Pull complete
ba755a256dfe: Pull complete
c57dd87d0b93: Pull complete
d7fbf29df889: Pull complete
1f1070938ccd: Pull complete
Digest: sha256:36b74457bccb56fbf8b05f79c85569501b721d4db813b684391d63e02287c0b2
Status: Downloaded newer image for nginx:latest
docker.io/library/nginx:latest
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest 08393e824c32 6 days ago 132MB
centos latest 831691599b88 7 weeks ago 215MB
# -d 后台运行
# --name 给容器命名
# -p 宿主机端口:容器内部端口
[root@localhost ~]# docker run -d --name nginx01 -p 28901:80 nginx
dbd1ef71b698c7b53e44d3308dffd78c63a0bb09b9f01e1b7aa44bd91545bbe9
[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
dbd1ef71b698 nginx "/docker-entrypoint.…" 7 seconds ago Up 6 seconds 0.0.0.0:28901->80/tcp nginx01
[root@localhost ~]# curl localhost:28901
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
[root@localhost ~]#
# 进入容器
[root@localhost ~]# docker exec -it dbd1ef71b698 /bin/bash
root@dbd1ef71b698:/# whereis nginx
nginx: /usr/sbin/nginx /usr/lib/nginx /etc/nginx /usr/share/nginx
root@dbd1ef71b698:/# cd /etc/nginx
root@dbd1ef71b698:/etc/nginx# ls
conf.d koi-utf mime.types nginx.conf uwsgi_params
fastcgi_params koi-win modules scgi_params win-utf
root@dbd1ef71b698:/etc/nginx#
思考问题:每次更改nginx配置文件,都要进入容器内部,十分的麻烦,我要是可以在容器外部提供一个映射路径,达到在容器修改文件名,容器内部就可以自动修改 -v 数据源技术!
Docker安装tomcat
# 官方的使用
docker run -it --rm tomcat:9.0
# 我们之前的启动都是后台,停止了容器之后,容器还是可以查到 docker run -it --rm ,一般用来测试,用完就删除
[root@localhost ~]# docker run -it --rm tomcat:9.0
Unable to find image 'tomcat:9.0' locally
9.0: Pulling from library/tomcat
d6ff36c9ec48: Pull complete
c958d65b3090: Pull complete
edaf0a6b092f: Pull complete
80931cf68816: Pull complete
bf04b6bbed0c: Pull complete
8bf847804f9e: Pull complete
fa776a6e7e37: Pull complete
586534165c2f: Pull complete
0f6d126a6962: Pull complete
9f3317edffb3: Pull complete
Digest: sha256:9de2415ccf10fe8e5906e4b72eda21649a7a1d0b88e9111f8409062599f3728e
Status: Downloaded newer image for tomcat:9.0
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/local/openjdk-11
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
NOTE: Picked up JDK_JAVA_OPTIONS: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
11-Aug-2020 11:56:56.998 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version name: Apache Tomcat/9.0.37
11-Aug-2020 11:56:57.002 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Jun 30 2020 20:09:49 UTC
11-Aug-2020 11:56:57.002 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version number: 9.0.37.0
11-Aug-2020 11:56:57.002 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
11-Aug-2020 11:56:57.002 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 3.10.0-693.el7.x86_64
11-Aug-2020 11:56:57.002 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
11-Aug-2020 11:56:57.004 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /usr/local/openjdk-11
11-Aug-2020 11:56:57.004 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 11.0.8+10
11-Aug-2020 11:56:57.005 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
11-Aug-2020 11:56:57.005 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /usr/local/tomcat
11-Aug-2020 11:56:57.005 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /usr/local/tomcat
11-Aug-2020 11:56:57.026 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.lang=ALL-UNNAMED
11-Aug-2020 11:56:57.027 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.io=ALL-UNNAMED
11-Aug-2020 11:56:57.027 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
11-Aug-2020 11:56:57.027 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties
11-Aug-2020 11:56:57.027 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
11-Aug-2020 11:56:57.027 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
11-Aug-2020 11:56:57.027 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
11-Aug-2020 11:56:57.027 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
11-Aug-2020 11:56:57.028 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
11-Aug-2020 11:56:57.028 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/usr/local/tomcat
11-Aug-2020 11:56:57.028 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/usr/local/tomcat
11-Aug-2020 11:56:57.028 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/usr/local/tomcat/temp
11-Aug-2020 11:56:57.028 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded Apache Tomcat Native library [1.2.24] using APR version [1.6.5].
11-Aug-2020 11:56:57.028 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
11-Aug-2020 11:56:57.028 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
11-Aug-2020 11:56:57.036 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 1.1.1d 10 Sep 2019]
11-Aug-2020 11:56:57.531 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
11-Aug-2020 11:56:57.589 INFO [main] org.apache.catalina.startup.Catalina.load Server initialization in [932] milliseconds
11-Aug-2020 11:56:57.662 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
11-Aug-2020 11:56:57.663 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/9.0.37]
11-Aug-2020 11:56:57.677 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
11-Aug-2020 11:56:57.713 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [122] milliseconds
^C11-Aug-2020 11:57:36.418 INFO [Thread-3] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-8080"]
11-Aug-2020 11:57:36.439 INFO [Thread-3] org.apache.catalina.core.StandardService.stopInternal Stopping service [Catalina]
11-Aug-2020 11:57:36.453 INFO [Thread-3] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-nio-8080"]
11-Aug-2020 11:57:36.470 INFO [Thread-3] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-nio-8080"]
[root@localhost ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
dbd1ef71b698 nginx "/docker-entrypoint.…" 22 minutes ago Up 10 minutes 0.0.0.0:28901->80/tcp nginx01
c7a1842f4263 centos "/bin/bash" 19 hours ago Exited (0) 19 hours ago fervent_franklin
[root@localhost ~]#
# 下载再启动
docker pull tomcat:9.0
# 启动运行
docker run -d -p 28902:8080 --name tomcat01 tomcat
#测试访问没有问题
HTTP404-未找到
# 进入容器
# 发现问题:1. linux命令少了 2. 没有webapps 导致404,阿里云镜像的原因,默认是最小的景象,所有不必要的都剔除掉,保证最小可运行的环境
[root@localhost ~]# docker exec -it tomcat01 /bin/bash
root@56fb7cc31e67:/usr/local/tomcat# ls -al
total 124
drwxr-xr-x. 1 root root 30 Aug 5 19:22 .
drwxr-xr-x. 1 root root 20 Aug 5 19:18 ..
-rw-r--r--. 1 root root 18982 Jun 30 20:14 BUILDING.txt
-rw-r--r--. 1 root root 5409 Jun 30 20:14 CONTRIBUTING.md
-rw-r--r--. 1 root root 57092 Jun 30 20:14 LICENSE
-rw-r--r--. 1 root root 2333 Jun 30 20:14 NOTICE
-rw-r--r--. 1 root root 3255 Jun 30 20:14 README.md
-rw-r--r--. 1 root root 6898 Jun 30 20:14 RELEASE-NOTES
-rw-r--r--. 1 root root 16262 Jun 30 20:14 RUNNING.txt
drwxr-xr-x. 2 root root 4096 Aug 5 19:23 bin
drwxr-xr-x. 1 root root 22 Aug 11 12:01 conf
drwxr-xr-x. 2 root root 4096 Aug 5 19:22 lib
drwxrwxrwx. 1 root root 177 Aug 11 12:01 logs
drwxr-xr-x. 2 root root 134 Aug 5 19:22 native-jni-lib
drwxrwxrwx. 2 root root 30 Aug 5 19:22 temp
drwxr-xr-x. 2 root root 6 Aug 5 19:22 webapps
drwxr-xr-x. 7 root root 81 Jun 30 20:12 webapps.dist
drwxrwxrwx. 2 root root 6 Jun 30 20:09 work
root@56fb7cc31e67:/usr/local/tomcat# ls
BUILDING.txt LICENSE README.md RUNNING.txt conf logs temp webapps.dist
CONTRIBUTING.md NOTICE RELEASE-NOTES bin lib native-jni-lib webapps work
root@56fb7cc31e67:/usr/local/tomcat# ll
bash: ll: command not found
root@56fb7cc31e67:/usr/local/tomcat# cd /webapps
bash: cd: /webapps: No such file or directory
root@56fb7cc31e67:/usr/local/tomcat# cd webapps
root@56fb7cc31e67:/usr/local/tomcat/webapps# ls
root@56fb7cc31e67:/usr/local/tomcat/webapps#
root@56fb7cc31e67:/usr/local/tomcat/webapps# cd ..
root@56fb7cc31e67:/usr/local/tomcat# ls
# 发现 webapps.dist文件夹
BUILDING.txt LICENSE README.md RUNNING.txt conf logs temp webapps.dist
CONTRIBUTING.md NOTICE RELEASE-NOTES bin lib native-jni-lib webapps work
# 进入webapps.dist文件夹
root@56fb7cc31e67:/usr/local/tomcat# cd webapps.dist
root@56fb7cc31e67:/usr/local/tomcat/webapps.dist# ls
ROOT docs examples host-manager manager
root@56fb7cc31e67:/usr/local/tomcat/webapps.dist# cp webapps.dist/* webapps
cp: cannot stat 'webapps.dist/*': No such file or directory
root@56fb7cc31e67:/usr/local/tomcat/webapps.dist# cd ..
root@56fb7cc31e67:/usr/local/tomcat# cp webapps.dist/* webapps
cp: -r not specified; omitting directory 'webapps.dist/ROOT'
cp: -r not specified; omitting directory 'webapps.dist/docs'
cp: -r not specified; omitting directory 'webapps.dist/examples'
cp: -r not specified; omitting directory 'webapps.dist/host-manager'
cp: -r not specified; omitting directory 'webapps.dist/manager'
# 拷贝webapps.dist下的项目到webapps文件夹
root@56fb7cc31e67:/usr/local/tomcat# cp -r webapps.dist/* webapps
root@56fb7cc31e67:/usr/local/tomcat# cd webapps
root@56fb7cc31e67:/usr/local/tomcat/webapps# ls
ROOT docs examples host-manager manager
思考问题: 以后部署项目,如果每次都要进入容器,十分的麻烦,我要是可以在容器外部提供一个映射路径,webapps,我们在外部防止项目,就自动同步到内部就好了
部署ES+Kibana
# es 暴露的端口很多
# es 十分的耗内存
# es 的数据一般要放置到安全目录! 挂载
# --net somnetwork ? 网络配置
# docker run -d --name elasticsearch --net somenetwork -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:tag
#启动elasticserach
docker run -d --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:7.6.2
docker run -d --name elasticsearch -p 28903:9200 -p 28904:9300 -e "discovery.type=single-node" elasticsearch:7.6.2
#启动了 linux服务器就卡住了 docker stats 查看cpu状态
#es 是十分耗内存的 1G以上
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
417b22e887c3 elasticsearch 0.53% 1.236GiB / 7.639GiB 16.18% 648B / 0B 0B / 0B 43
56fb7cc31e67 tomcat01 0.20% 190.1MiB / 7.639GiB 2.43% 8.18kB / 62.8kB 0B / 0B 37
dbd1ef71b698 nginx01 0.00% 1.422MiB / 7.639GiB 0.02% 2.23kB / 894B 0B / 0B
# docker ps 测试一下es是否成功
[root@localhost ~]# docker run -d --name elasticsearch -p 28903:9200 -p 28904:9300 -e "discovery.type=single-node" elasticsearch:7.6.2
4f45cfcfb0111e1a72d959b9292066070fbe5cc105700f4234a425a08edf5efa
[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4f45cfcfb011 elasticsearch:7.6.2 "/usr/local/bin/dock…" 16 seconds ago Up 15 seconds 0.0.0.0:28903->9200/tcp, 0.0.0.0:28904->9300/tcp elasticsearch
56fb7cc31e67 tomcat "catalina.sh run" 36 minutes ago Up 36 minutes 0.0.0.0:28902->8080/tcp tomcat01
dbd1ef71b698 nginx "/docker-entrypoint.…" About an hour ago Up 50 minutes 0.0.0.0:28901->80/tcp nginx01
[root@localhost ~]# curl localhost:28903
{
"name" : "4f45cfcfb011",
"cluster_name" : "docker-cluster",
"cluster_uuid" : "MCPcHBCtTDCnHDmDCRixkg",
"version" : {
"number" : "7.6.2",
"build_flavor" : "default",
"build_type" : "docker",
"build_hash" : "ef48eb35cf30adf4db14086e8aabd07ef6fb113f",
"build_date" : "2020-03-26T06:34:37.794943Z",
"build_snapshot" : false,
"lucene_version" : "8.4.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
[root@localhost ~]#
# 赶紧关闭 增加内存的限制 , 修改配置文件 -e 环境配置修改
docker run -d --name elasticsearch02 -p 28903:9200 -p 28904:9300 -e "discovery.type=single-node" -e ES_JAVA_OPTS="-Xms64m -Xmx512m" elasticsearch:7.6.2
# 查看docker stats
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
ffa8ab843dfb elasticsearch02 2.40% 348.5MiB / 7.639GiB 4.46% 648B / 0B 0B / 0B 44
56fb7cc31e67 tomcat01 0.16% 190.2MiB / 7.639GiB 2.43% 8.53kB / 62.8kB 0B / 0B 37
dbd1ef71b698 nginx01 0.00% 1.422MiB / 7.639GiB 0.02% 4.23kB / 3.28kB 0B / 0B 2
作业:使用Kibana连接ES?思考网络如何才能连接过去
可视化
- portainer (先用这个)
- Rancher (CI/CD)
什么是portainer?
Docker图形化界面管理工具! 提供一个后台面板供我们操作 !
docker run -d -p 28905:9000 \
--restart=always -v /var/run/docker.sock:/var/run/docker.sock --privileged=true portainer/portainer
[root@localhost ~]# systemctl start docker
[root@localhost ~]# docker run -d -p 28905:9000 \
> --restart=always -v /var/run/docker.sock:/var/run/docker.sock --privileged=true portainer/portiner
Unable to find image 'portainer/portiner:latest' locally
docker: Error response from daemon: pull access denied for portainer/portiner, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.
[root@localhost ~]# docker run -d -p 28905:9000 \
> --restart=always -v /var/run/docker.sock:/var/run/docker.sock --privileged=true portainer/portainer
Unable to find image 'portainer/portainer:latest' locally
latest: Pulling from portainer/portainer
d1e017099d17: Pull complete
717377b83d5c: Pull complete
Digest: sha256:f8c2b0a9ca640edf508a8a0830cf1963a1e0d2fd9936a64104b3f658e120b868
Status: Downloaded newer image for portainer/portainer:latest
ff20c119f6d201890a4bfd7f1cd7bb4bddecf6f1b972cfee666e842602781d9e
[root@localhost ~]#
开始访问portainer