一、容器的创建
1.运行一个挂掉的容器
docker run centos
[root@node1 ~]
[root@node1 ~]
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d01b358d1736 centos "/bin/bash" 4 seconds ago Exited (0) 3 seconds ago gallant_williamson
2db168499262 redis "docker-entrypoint.s…" 24 hours ago Up 24 hours 6379/tcp, 0.0.0.0:8021->8021/tcp, :::8021->8021/tcp cool_ganguly
7bbc90aa1235 nginx "/docker-entrypoint.…" 24 hours ago Created relaxed_brahmagupta
2d9e649a84a2 opensuse "/bin/bash" 24 hours ago Exited (0) 24 hours ago objective_mcnulty
731daf4ecc83 opensuse "bash" 24 hours ago Exited (0) 24 hours ago serene_herschel
5bb956ef369a opensuse "bash" 24 hours ago Exited (0) 24 hours ago vibrant_hopper
fd583c3fba25 fedora "bash" 24 hours ago Exited (0) 24 hours ago practical_tharp
43d6bca30131 centos "bash" 24 hours ago Exited (0) 24 hours ago charming_nightingale
c2e14edd678d ubuntu "bash" 24 hours ago Exited (0) 24 hours ago gracious_robinson
2716e3ec1417 nginx "/docker-entrypoint.…" 25 hours ago Up 25 hours 0.0.0.0:80->80/tcp, :::80->80/tcp naughty_driscoll
273f0fc6a18c nginx "/docker-entrypoint.…" 25 hours ago Created 0.0.0.0:80->80/tcp, :::80->80/tcp relaxed_bassi
68076e397891 nginx "/docker-entrypoint.…" 26 hours ago Created 0.0.0.0:80->80/tcp, :::80->80/tcp crazy_bardeen
964648a939b9 nginx "/docker-entrypoint.…" 26 hours ago Created
2.开启容器运行某个程序
运行容器,且进入容器空间内,运行某个命令
[root@node1 ~]
PING baidu.com (220.181.38.148) 56(84) bytes of data.
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=1 ttl=127 time=31.9 ms
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=2 ttl=127 time=32.2 ms
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=3 ttl=127 time=32.0 ms
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=4 ttl=127 time=31.7 ms
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=5 ttl=127 time=32.6 ms
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=6 ttl=127 time=32.2 ms
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=7 ttl=127 time=32.1 ms
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=8 ttl=127 time=32.2 ms
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=9 ttl=127 time=31.4 ms
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=10 ttl=127 time=31.4 ms
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=11 ttl=127 time=32.1 ms
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=12 ttl=127 time=31.7 ms
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=13 ttl=127 time=32.1 ms
^C
--- baidu.com ping statistics ---
13 packets transmitted, 13 received, 0% packet loss, time 12025ms
rtt min/avg/max/mdev = 31.452/32.021/32.684/0.365 ms
3.运行一个存活的容器
-d 让容器存活运行,针对宿主机而言
--rm 容器挂掉后自动删除
--name 命令容器名称
[root@node1 ~]
91abb153df28322c9dcb1dc4a398f21341ca5613c8ecf8b86e996a142e4eaf74
[root@node1 ~]
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
91abb153df28 centos:7.8.2003 "ping baidu.com" 5 seconds ago Up 5 seconds suspicious_hoover
2db168499262 redis "docker-entrypoint.s…" 24 hours ago Up 24 hours 6379/tcp, 0.0.0.0:8021->8021/tcp, :::8021->8021/tcp cool_ganguly
2716e3ec1417 nginx "/docker-entrypoint.…" 26 hours ago Up 25 hours 0.0.0.0:80->80/tcp, :::80->80/tcp
4.自定义容器名称
root@node1 ~]
cac482a9861efdef656de62b7906d2aa41444c7fc969c44e3f9a2311a6e8b624
[root@node1 ~]
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cac482a9861e centos:7.8.2003 "ping baidu.com" 3 seconds ago Up 3 seconds test-ping
91abb153df28 centos:7.8.2003 "ping baidu.com" 4 minutes ago Up 4 minutes suspicious_hoover
2db168499262 redis "docker-entrypoint.s…" 24 hours ago Up 24 hours 6379/tcp, 0.0.0.0:8021->8021/tcp, :::8021->8021/tcp cool_ganguly
2716e3ec1417 nginx "/docker-entrypoint.…" 26 hours ago Up 26 hours 0.0.0.0:80->80/tcp, :::80->80/tcp naughty_driscoll
[root@node1 ~]
cac482a9861e
[root@node1 ~]
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
91abb153df28 centos:7.8.2003 "ping baidu.com" 8 minutes ago Up 8 minutes suspicious_hoover
09792427acc4 centos:7.8.2003 "ping baidu.com" 11 minutes ago Exited (0) 11 minutes ago nervous_banzai
aec6f916a630 centos:7.8.2003 "ping baidu.com" 12 minutes ago Exited (0) 11 minutes ago pensive_clarke
6ad4643c4447 centos:7.8.2003 "ping www.baidu.com" 12 minutes ago Exited (2) 12 minutes ago objective_sutherland
dbbdd69a7944 centos:7.8.2003 "bash" 14 minutes ago Exited (0) 14 minutes ago friendly_haslett
d01b358d1736 centos "/bin/bash" 17 minutes ago Exited (0) 17 minutes ago gallant_williamson
2db168499262 redis "docker-entrypoint.s…" 24 hours ago Up 24 hours 6379/tcp, 0.0.0.0:8021->8021/tcp, :::8021->8021/tcp cool_ganguly
7bbc90aa1235 nginx "/docker-entrypoint.…" 24 hours ago Created relaxed_brahmagupta
2d9e649a84a2 opensuse "/bin/bash" 24 hours ago Exited (0) 24 hours ago objective_mcnulty
731daf4ecc83 opensuse "bash" 24 hours ago Exited (0) 24 hours ago serene_herschel
5bb956ef369a opensuse "bash" 24 hours ago Exited (0) 24 hours ago vibrant_hopper
fd583c3fba25 fedora "bash" 24 hours ago Exited (0) 24 hours ago practical_tharp
43d6bca30131 centos "bash" 24 hours ago Exited (0) 24 hours ago charming_nightingale
c2e14edd678d ubuntu "bash" 24 hours ago Exited (0) 24 hours ago gracious_robinson
2716e3ec1417 nginx "/docker-entrypoint.…" 26 hours ago Up 26 hours 0.0.0.0:80->80/tcp, :::80->80/tcp naughty_driscoll
273f0fc6a18c nginx "/docker-entrypoint.…" 26 hours ago Created 0.0.0.0:80->80/tcp, :::80->80/tcp relaxed_bassi
68076e397891 nginx "/docker-entrypoint.…" 26 hours ago Created 0.0.0.0:80->80/tcp, :::80->80/tcp crazy_bardeen
964648a939b9 nginx "/docker-entrypoint.…" 26 hours ago Created
二、查看容器的日志
1.实时监控某个容器日志
[root@node1 ~]
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2021/07/21 14:24:17 [notice] 1
2021/07/21 14:24:17 [notice] 1
2021/07/21 14:24:17 [notice] 1
2021/07/21 14:24:17 [notice] 1
2021/07/21 14:24:17 [notice] 1
2021/07/21 14:24:17 [notice] 1
2021/07/21 14:24:17 [notice] 1
2021/07/21 14:27:45 [error] 31
192.168.200.1 - - [21/Jul/2021:14:27:45 +0000] "GET /24 HTTP/1.1" 404 555 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36" "-"
2021/07/21 14:27:45 [error] 31
192.168.200.1 - - [21/Jul/2021:14:27:45 +0000] "GET /favicon.ico HTTP/1.1" 404 555 "http://192.168.200.135/24" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36" "-"
2021/07/21 14:27:50 [error] 31
192.168.200.1 - - [21/Jul/2021:14:27:50 +0000] "GET /24 HTTP/1.1" 404 555 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36" "-"
192.168.200.1 - - [21/Jul/2021:14:28:00 +0000] "GET / HTTP/1.1" 200 612 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36" "-"
2021/07/21 14:31:04 [notice] 1
2021/07/21 14:31:04 [notice] 31
2021/07/21 14:31:04 [notice] 31
2021/07/21 14:31:04 [notice] 31
2021/07/21 14:31:04 [notice] 1
2021/07/21 14:31:04 [notice] 1
2021/07/21 14:31:04 [notice] 1
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: IPv6 listen already enabled
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2021/07/21 14:31:18 [notice] 1
2021/07/21 14:31:18 [notice] 1
2021/07/21 14:31:18 [notice] 1
2021/07/21 14:31:18 [notice] 1
2021/07/21 14:31:18 [notice] 1
2021/07/21 14:31:18 [notice] 1
2021/07/21 14:31:18 [notice] 1
2.过滤某个容器日志
[root@node1 ~]
64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=780 ttl=127 time=30.1 ms
64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=781 ttl=127 time=29.8 ms
64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=782 ttl=127 time=29.7 ms
64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=783 ttl=127 time=29.5 ms
64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=784 ttl=127 time=30.1 ms
三、进入正在运行的容器空间
[root@node1 ~]
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
91abb153df28 centos:7.8.2003 "ping baidu.com" 16 minutes ago Up 16 minutes suspicious_hoover
2db168499262 redis "docker-entrypoint.s…" 24 hours ago Up 24 hours 6379/tcp, 0.0.0.0:8021->8021/tcp, :::8021->8021/tcp cool_ganguly
2716e3ec1417 nginx "/docker-entrypoint.…" 26 hours ago Up 26 hours 0.0.0.0:80->80/tcp, :::80->80/tcp naughty_driscoll
[root@node1 ~]
[root@91abb153df28 /]
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 16:00 ? 00:00:00 ping baidu.com
root 7 0 0 16:17 pts/0 00:00:00 bash
root 21 7 0 16:17 pts/0 00:00:00 ps -ef
四、查看容器的信息
[root@node1 ~]
[
{
"Id": "91abb153df28322c9dcb1dc4a398f21341ca5613c8ecf8b86e996a142e4eaf74",
"Created": "2021-07-22T16:00:25.2705954Z",
"Path": "ping",
"Args": [
"baidu.com"
],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 14927,
"ExitCode": 0,
"Error": "",
"StartedAt": "2021-07-22T16:00:25.481107024Z",
"FinishedAt": "0001-01-01T00:00:00Z"
},
"Image": "sha256:afb6fca791e071c66276202f8efca5ce3d3dc4fb218bcddff1bc565d981ddd1e",
"ResolvConfPath": "/var/lib/docker/containers/91abb153df28322c9dcb1dc4a398f21341ca5613c8ecf8b86e996a142e4eaf74/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/91abb153df28322c9dcb1dc4a398f21341ca5613c8ecf8b86e996a142e4eaf74/hostname",
"HostsPath": "/var/lib/docker/containers/91abb153df28322c9dcb1dc4a398f21341ca5613c8ecf8b86e996a142e4eaf74/hosts",
"LogPath": "/var/lib/docker/containers/91abb153df28322c9dcb1dc4a398f21341ca5613c8ecf8b86e996a142e4eaf74/91abb153df28322c9dcb1dc4a398f21341ca5613c8ecf8b86e996a142e4eaf74-json.log",
"Name": "/suspicious_hoover",
"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/461b6d0fd0a94cb0ca5fdbbfc1bfb6371e58d05fbc3d9d5d868e33efb86f61bc-init/diff:/var/lib/docker/overlay2/c4fc8645dba560891da2786efe974432eb221f63cc8986ecccb4a28a77176ce9/diff",
"MergedDir": "/var/lib/docker/overlay2/461b6d0fd0a94cb0ca5fdbbfc1bfb6371e58d05fbc3d9d5d868e33efb86f61bc/merged",
"UpperDir": "/var/lib/docker/overlay2/461b6d0fd0a94cb0ca5fdbbfc1bfb6371e58d05fbc3d9d5d868e33efb86f61bc/diff",
"WorkDir": "/var/lib/docker/overlay2/461b6d0fd0a94cb0ca5fdbbfc1bfb6371e58d05fbc3d9d5d868e33efb86f61bc/work"
},
"Name": "overlay2"
},
"Mounts": [],
"Config": {
"Hostname": "91abb153df28",
"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": [
"ping",
"baidu.com"
],
"Image": "centos:7.8.2003",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": {
"org.label-schema.build-date": "20200504",
"org.label-schema.license": "GPLv2",
"org.label-schema.name": "CentOS Base Image",
"org.label-schema.schema-version": "1.0",
"org.label-schema.vendor": "CentOS",
"org.opencontainers.image.created": "2020-05-04 00:00:00+01:00",
"org.opencontainers.image.licenses": "GPL-2.0-only",
"org.opencontainers.image.title": "CentOS Base Image",
"org.opencontainers.image.vendor": "CentOS"
}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "a492cb90bf8e5100a4bf5228dfdab14efa0fa27fc3ed4cb92d0083bfba7ca3bd",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {},
"SandboxKey": "/var/run/docker/netns/a492cb90bf8e",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "9f57ed117bd308a40adc6e0c8563309c0559adc2ab69d81e28af563ab53ce4dd",
"Gateway": "172.17.0.1",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "172.17.0.4",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"MacAddress": "02:42:ac:11:00:04",
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "9d69c7098d163d0e7e02b1e6da0feed684de33bd6b5a6f16d75900d74fa3f91c",
"EndpointID": "9f57ed117bd308a40adc6e0c8563309c0559adc2ab69d81e28af563ab53ce4dd",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.4",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:11:00:04",
"DriverOpts": null
}
}
}
}
]
五、容器的端口映射
1.进入容器内查看服务文件
[root@node1 ~]
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
/
bin boot dev docker-entrypoint.d docker-entrypoint.sh etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
set -e
if [ -z "${NGINX_ENTRYPOINT_QUIET_LOGS:-}" ]; then
exec 3>&1
else
exec 3>/dev/null
fi
if [ "$1" = "nginx" -o "$1" = "nginx-debug" ]; then
if /usr/bin/find "/docker-entrypoint.d/" -mindepth 1 -maxdepth 1 -type f -print -quit 2>/dev/null | read v; then
echo >&3 "$0: /docker-entrypoint.d/ is not empty, will attempt to perform configuration"
echo >&3 "$0: Looking for shell scripts in /docker-entrypoint.d/"
find "/docker-entrypoint.d/" -follow -type f -print | sort -V | while read -r f; do
case "$f" in
*.sh)
if [ -x "$f" ]; then
echo >&3 "$0: Launching $f";
"$f"
else
echo >&3 "$0: Ignoring $f, not executable";
fi
;;
*) echo >&3 "$0: Ignoring $f";;
esac
done
echo >&3 "$0: Configuration complete; ready for start up"
else
echo >&3 "$0: No files found in /docker-entrypoint.d/, skipping configuration"
fi
fi
exec "$@"
2.进行容器端口映射
后台运行nginx容器,并且命名容器空间,且端口映射宿主主机的85端口,访问容器的80端口
[root@node1 ~]
eee0a7682471663bc13de8ad4474cf63babd8a18b1b4d695392ae33d9de6ce76
[root@node1 ~]
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
eee0a7682471 nginx "/docker-entrypoint.…" 4 seconds ago Up 3 seconds 0.0.0.0:85->80/tcp, :::85->80/tcp web
91abb153df28 centos:7.8.2003 "ping baidu.com" 31 minutes ago Up 31 minutes suspicious_hoover
2db168499262 redis "docker-entrypoint.s…" 25 hours ago Up 25 hours 6379/tcp, 0.0.0.0:8021->8021/tcp, :::8021->8021/tcp cool_ganguly
[root@node1 ~]
3.查看容器的端口转发情况
[root@node1 ~]
80/tcp -> 0.0.0.0:85
80/tcp -> :::85
4.测试web页面
5.随机端口映射
[root@node1 ~]
ac598bc79e84e3ec9da061d62b084992b1dc4d95137601a16887c761c128c3f2
[root@node1 ~]
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ac598bc79e84 nginx "/docker-entrypoint.…" 8 seconds ago Up 7 seconds 0.0.0.0:49153->80/tcp, :::49153->80/tcp web001
eee0a7682471 nginx "/docker-entrypoint.…" 5 minutes ago Up 5 minutes 0.0.0.0:85->80/tcp, :::85->80/tcp web
91abb153df28 centos:7.8.2003 "ping baidu.com" 37 minutes ago Up 37 minutes suspicious_hoover
2db168499262 redis "docker-entrypoint.s…" 25 hours ago Up 25 hours 6379/tcp, 0.0.0.0:8021->8021/tcp, :::8021->8021/tcp cool_ganguly
六、容器的提交
备注:运行一个基础的centos镜像,在容器内安装vim,然后提交镜像。 新的镜像再运行出的容器,默认就有vim功能。
1.运行容器安装vim
[root@node1 ~]
[root@680cce5c0b5f /]
Loaded plugins: fastestmirror, ovl
Determining fastest mirrors
* base: mirrors.huaweicloud.com
* extras: mirrors.huaweicloud.com
* updates: mirrors.aliyun.com
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/4): base/7/x86_64/group_gz | 153 kB 00:00:00
(2/4): extras/7/x86_64/primary_db | 242 kB 00:00:00
(3/4): base/7/x86_64/primary_db | 6.1 MB 00:00:00
(4/4): updates/7/x86_64/primary_db | 9.5 MB 00:00:01
Resolving Dependencies
--> Running transaction check
---> Package vim-enhanced.x86_64 2:7.4.629-8.el7_9 will be installed
--> Processing Dependency: vim-common = 2:7.4.629-8.el7_9 for package: 2:vim-enhanced-7.4.629-8.el7_9.x86_64
--> Processing Dependency: which for package: 2:vim-enhanced-7.4.629-8.el7_9.x86_64
--> Processing Dependency: perl(:MODULE_COMPAT_5.16.3) for package: 2:vim-enhanced-7.4.629-8.el7_9.x86_64
--> Processing Dependency: libperl.so()(64bit) for package: 2:vim-enhanced-7.4.629-8.el7_9.x86_64
--> Processing Dependency: libgpm.so.2()(64bit) for package: 2:vim-enhanced-7.4.629-8.el7_9.x86_64
--> Running transaction check
---> Package gpm-libs.x86_64 0:1.20.7-6.el7 will be installed
---> Package perl.x86_64 4:5.16.3-299.el7_9 will be installed
--> Processing Dependency: perl(Socket) >= 1.3 for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Scalar::Util) >= 1.10 for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl-macros for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(threads::shared) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(threads) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(constant) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Time::Local) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Time::HiRes) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Storable) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Socket) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Scalar::Util) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Pod::Simple::XHTML) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Pod::Simple::Search) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Getopt::Long) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Filter::Util::Call) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(File::Temp) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(File::Spec::Unix) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(File::Spec::Functions) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(File::Spec) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(File::Path) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Exporter) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Cwd) for package: 4:perl-5.16.3-299.el7_9.x86_64
--> Processing Dependency: perl(Carp) for package: 4:perl-5.16.3-299.el7_9.x86_64
---> Package perl-libs.x86_64 4:5.16.3-299.el7_9 will be installed
---> Package vim-common.x86_64 2:7.4.629-8.el7_9 will be installed
--> Processing Dependency: vim-filesystem for package: 2:vim-common-7.4.629-8.el7_9.x86_64
---> Package which.x86_64 0:2.20-7.el7 will be installed
--> Running transaction check
---> Package perl-Carp.noarch 0:1.26-244.el7 will be installed
---> Package perl-Exporter.noarch 0:5.68-3.el7 will be installed
---> Package perl-File-Path.noarch 0:2.09-2.el7 will be installed
---> Package perl-File-Temp.noarch 0:0.23.01-3.el7 will be installed
---> Package perl-Filter.x86_64 0:1.49-3.el7 will be installed
---> Package perl-Getopt-Long.noarch 0:2.40-3.el7 will be installed
--> Processing Dependency: perl(Pod::Usage) >= 1.14 for package: perl-Getopt-Long-2.40-3.el7.noarch
--> Processing Dependency: perl(Text::ParseWords) for package: perl-Getopt-Long-2.40-3.el7.noarch
---> Package perl-PathTools.x86_64 0:3.40-5.el7 will be installed
---> Package perl-Pod-Simple.noarch 1:3.28-4.el7 will be installed
--> Processing Dependency: perl(Pod::Escapes) >= 1.04 for package: 1:perl-Pod-Simple-3.28-4.el7.noarch
--> Processing Dependency: perl(Encode) for package: 1:perl-Pod-Simple-3.28-4.el7.noarch
---> Package perl-Scalar-List-Utils.x86_64 0:1.27-248.el7 will be installed
---> Package perl-Socket.x86_64 0:2.010-5.el7 will be installed
---> Package perl-Storable.x86_64 0:2.45-3.el7 will be installed
---> Package perl-Time-HiRes.x86_64 4:1.9725-3.el7 will be installed
---> Package perl-Time-Local.noarch 0:1.2300-2.el7 will be installed
---> Package perl-constant.noarch 0:1.27-2.el7 will be installed
---> Package perl-macros.x86_64 4:5.16.3-299.el7_9 will be installed
---> Package perl-threads.x86_64 0:1.87-4.el7 will be installed
---> Package perl-threads-shared.x86_64 0:1.43-6.el7 will be installed
---> Package vim-filesystem.x86_64 2:7.4.629-8.el7_9 will be installed
--> Running transaction check
---> Package perl-Encode.x86_64 0:2.51-7.el7 will be installed
---> Package perl-Pod-Escapes.noarch 1:1.04-299.el7_9 will be installed
---> Package perl-Pod-Usage.noarch 0:1.63-3.el7 will be installed
--> Processing Dependency: perl(Pod::Text) >= 3.15 for package: perl-Pod-Usage-1.63-3.el7.noarch
--> Processing Dependency: perl-Pod-Perldoc for package: perl-Pod-Usage-1.63-3.el7.noarch
---> Package perl-Text-ParseWords.noarch 0:3.29-4.el7 will be installed
--> Running transaction check
---> Package perl-Pod-Perldoc.noarch 0:3.20-4.el7 will be installed
--> Processing Dependency: perl(parent) for package: perl-Pod-Perldoc-3.20-4.el7.noarch
--> Processing Dependency: perl(HTTP::Tiny) for package: perl-Pod-Perldoc-3.20-4.el7.noarch
--> Processing Dependency: groff-base for package: perl-Pod-Perldoc-3.20-4.el7.noarch
---> Package perl-podlators.noarch 0:2.5.1-3.el7 will be installed
--> Running transaction check
---> Package groff-base.x86_64 0:1.22.2-8.el7 will be installed
---> Package perl-HTTP-Tiny.noarch 0:0.033-3.el7 will be installed
---> Package perl-parent.noarch 1:0.225-244.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==========================================================================================================================================================
Package Arch Version Repository Size
==========================================================================================================================================================
Installing:
vim-enhanced x86_64 2:7.4.629-8.el7_9 updates 1.1 M
Installing for dependencies:
gpm-libs x86_64 1.20.7-6.el7 base 32 k
groff-base x86_64 1.22.2-8.el7 base 942 k
perl x86_64 4:5.16.3-299.el7_9 updates 8.0 M
perl-Carp noarch 1.26-244.el7 base 19 k
perl-Encode x86_64 2.51-7.el7 base 1.5 M
perl-Exporter noarch 5.68-3.el7 base 28 k
perl-File-Path noarch 2.09-2.el7 base 26 k
perl-File-Temp noarch 0.23.01-3.el7 base 56 k
perl-Filter x86_64 1.49-3.el7 base 76 k
perl-Getopt-Long noarch 2.40-3.el7 base 56 k
perl-HTTP-Tiny noarch 0.033-3.el7 base 38 k
perl-PathTools x86_64 3.40-5.el7 base 82 k
perl-Pod-Escapes noarch 1:1.04-299.el7_9 updates 52 k
perl-Pod-Perldoc noarch 3.20-4.el7 base 87 k
perl-Pod-Simple noarch 1:3.28-4.el7 base 216 k
perl-Pod-Usage noarch 1.63-3.el7 base 27 k
perl-Scalar-List-Utils x86_64 1.27-248.el7 base 36 k
perl-Socket x86_64 2.010-5.el7 base 49 k
perl-Storable x86_64 2.45-3.el7 base 77 k
perl-Text-ParseWords noarch 3.29-4.el7 base 14 k
perl-Time-HiRes x86_64 4:1.9725-3.el7 base 45 k
perl-Time-Local noarch 1.2300-2.el7 base 24 k
perl-constant noarch 1.27-2.el7 base 19 k
perl-libs x86_64 4:5.16.3-299.el7_9 updates 690 k
perl-macros x86_64 4:5.16.3-299.el7_9 updates 44 k
perl-parent noarch 1:0.225-244.el7 base 12 k
perl-podlators noarch 2.5.1-3.el7 base 112 k
perl-threads x86_64 1.87-4.el7 base 49 k
perl-threads-shared x86_64 1.43-6.el7 base 39 k
vim-common x86_64 2:7.4.629-8.el7_9 updates 5.9 M
vim-filesystem x86_64 2:7.4.629-8.el7_9 updates 11 k
which x86_64 2.20-7.el7 base 41 k
Transaction Summary
==========================================================================================================================================================
Install 1 Package (+32 Dependent packages)
Total download size: 19 M
Installed size: 63 M
Downloading packages:
warning: /var/cache/yum/x86_64/7/base/packages/gpm-libs-1.20.7-6.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for gpm-libs-1.20.7-6.el7.x86_64.rpm is not installed
(1/33): gpm-libs-1.20.7-6.el7.x86_64.rpm | 32 kB 00:00:00
(2/33): perl-Carp-1.26-244.el7.noarch.rpm | 19 kB 00:00:00
(3/33): groff-base-1.22.2-8.el7.x86_64.rpm | 942 kB 00:00:00
(4/33): perl-Exporter-5.68-3.el7.noarch.rpm | 28 kB 00:00:00
(5/33): perl-File-Path-2.09-2.el7.noarch.rpm | 26 kB 00:00:00
(6/33): perl-File-Temp-0.23.01-3.el7.noarch.rpm | 56 kB 00:00:00
(7/33): perl-Filter-1.49-3.el7.x86_64.rpm | 76 kB 00:00:00
(8/33): perl-Getopt-Long-2.40-3.el7.noarch.rpm | 56 kB 00:00:00
(9/33): perl-HTTP-Tiny-0.033-3.el7.noarch.rpm | 38 kB 00:00:00
(10/33): perl-Encode-2.51-7.el7.x86_64.rpm | 1.5 MB 00:00:00
Public key for perl-5.16.3-299.el7_9.x86_64.rpm is not installed
(11/33): perl-5.16.3-299.el7_9.x86_64.rpm | 8.0 MB 00:00:00
(12/33): perl-PathTools-3.40-5.el7.x86_64.rpm | 82 kB 00:00:00
(13/33): perl-Pod-Simple-3.28-4.el7.noarch.rpm | 216 kB 00:00:00
(14/33): perl-Pod-Escapes-1.04-299.el7_9.noarch.rpm | 52 kB 00:00:00
(15/33): perl-Pod-Perldoc-3.20-4.el7.noarch.rpm | 87 kB 00:00:00
(16/33): perl-Scalar-List-Utils-1.27-248.el7.x86_64.rpm | 36 kB 00:00:00
(17/33): perl-Socket-2.010-5.el7.x86_64.rpm | 49 kB 00:00:00
(18/33): perl-Pod-Usage-1.63-3.el7.noarch.rpm | 27 kB 00:00:00
(19/33): perl-Text-ParseWords-3.29-4.el7.noarch.rpm | 14 kB 00:00:00
(20/33): perl-Storable-2.45-3.el7.x86_64.rpm | 77 kB 00:00:00
(21/33): perl-Time-Local-1.2300-2.el7.noarch.rpm | 24 kB 00:00:00
(22/33): perl-Time-HiRes-1.9725-3.el7.x86_64.rpm | 45 kB 00:00:00
(23/33): perl-constant-1.27-2.el7.noarch.rpm | 19 kB 00:00:00
(24/33): perl-parent-0.225-244.el7.noarch.rpm | 12 kB 00:00:00
(25/33): perl-podlators-2.5.1-3.el7.noarch.rpm | 112 kB 00:00:00
(26/33): perl-threads-shared-1.43-6.el7.x86_64.rpm | 39 kB 00:00:00
(27/33): perl-macros-5.16.3-299.el7_9.x86_64.rpm | 44 kB 00:00:00
(28/33): perl-threads-1.87-4.el7.x86_64.rpm | 49 kB 00:00:00
(29/33): perl-libs-5.16.3-299.el7_9.x86_64.rpm | 690 kB 00:00:00
(30/33): vim-enhanced-7.4.629-8.el7_9.x86_64.rpm | 1.1 MB 00:00:00
(31/33): vim-filesystem-7.4.629-8.el7_9.x86_64.rpm | 11 kB 00:00:00
(32/33): which-2.20-7.el7.x86_64.rpm | 41 kB 00:00:00
(33/33): vim-common-7.4.629-8.el7_9.x86_64.rpm | 5.9 MB 00:00:00
----------------------------------------------------------------------------------------------------------------------------------------------------------
Total 8.8 MB/s | 19 MB 00:00:02
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
Userid : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
Package : centos-release-7-8.2003.0.el7.centos.x86_64 (@CentOS)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : gpm-libs-1.20.7-6.el7.x86_64 1/33
Installing : 2:vim-filesystem-7.4.629-8.el7_9.x86_64 2/33
Installing : 2:vim-common-7.4.629-8.el7_9.x86_64 3/33
Installing : which-2.20-7.el7.x86_64 4/33
install-info: No such file or directory for /usr/share/info/which.info.gz
Installing : groff-base-1.22.2-8.el7.x86_64 5/33
Installing : 1:perl-parent-0.225-244.el7.noarch 6/33
Installing : perl-HTTP-Tiny-0.033-3.el7.noarch 7/33
Installing : perl-podlators-2.5.1-3.el7.noarch 8/33
Installing : perl-Pod-Perldoc-3.20-4.el7.noarch 9/33
Installing : 1:perl-Pod-Escapes-1.04-299.el7_9.noarch 10/33
Installing : perl-Encode-2.51-7.el7.x86_64 11/33
Installing : perl-Text-ParseWords-3.29-4.el7.noarch 12/33
Installing : perl-Pod-Usage-1.63-3.el7.noarch 13/33
Installing : 4:perl-macros-5.16.3-299.el7_9.x86_64 14/33
Installing : perl-Storable-2.45-3.el7.x86_64 15/33
Installing : perl-Exporter-5.68-3.el7.noarch 16/33
Installing : perl-constant-1.27-2.el7.noarch 17/33
Installing : perl-Socket-2.010-5.el7.x86_64 18/33
Installing : perl-Time-Local-1.2300-2.el7.noarch 19/33
Installing : perl-Carp-1.26-244.el7.noarch 20/33
Installing : perl-PathTools-3.40-5.el7.x86_64 21/33
Installing : perl-Scalar-List-Utils-1.27-248.el7.x86_64 22/33
Installing : 1:perl-Pod-Simple-3.28-4.el7.noarch 23/33
Installing : perl-File-Temp-0.23.01-3.el7.noarch 24/33
Installing : perl-File-Path-2.09-2.el7.noarch 25/33
Installing : perl-threads-shared-1.43-6.el7.x86_64 26/33
Installing : perl-threads-1.87-4.el7.x86_64 27/33
Installing : 4:perl-Time-HiRes-1.9725-3.el7.x86_64 28/33
Installing : perl-Filter-1.49-3.el7.x86_64 29/33
Installing : 4:perl-libs-5.16.3-299.el7_9.x86_64 30/33
Installing : perl-Getopt-Long-2.40-3.el7.noarch 31/33
Installing : 4:perl-5.16.3-299.el7_9.x86_64 32/33
Installing : 2:vim-enhanced-7.4.629-8.el7_9.x86_64 33/33
Verifying : perl-HTTP-Tiny-0.033-3.el7.noarch 1/33
Verifying : perl-threads-shared-1.43-6.el7.x86_64 2/33
Verifying : perl-Storable-2.45-3.el7.x86_64 3/33
Verifying : groff-base-1.22.2-8.el7.x86_64 4/33
Verifying : perl-Exporter-5.68-3.el7.noarch 5/33
Verifying : perl-constant-1.27-2.el7.noarch 6/33
Verifying : perl-PathTools-3.40-5.el7.x86_64 7/33
Verifying : 4:perl-macros-5.16.3-299.el7_9.x86_64 8/33
Verifying : 2:vim-enhanced-7.4.629-8.el7_9.x86_64 9/33
Verifying : 1:perl-parent-0.225-244.el7.noarch 10/33
Verifying : perl-Socket-2.010-5.el7.x86_64 11/33
Verifying : which-2.20-7.el7.x86_64 12/33
Verifying : 2:vim-filesystem-7.4.629-8.el7_9.x86_64 13/33
Verifying : perl-File-Temp-0.23.01-3.el7.noarch 14/33
Verifying : 1:perl-Pod-Simple-3.28-4.el7.noarch 15/33
Verifying : perl-Time-Local-1.2300-2.el7.noarch 16/33
Verifying : 1:perl-Pod-Escapes-1.04-299.el7_9.noarch 17/33
Verifying : perl-Carp-1.26-244.el7.noarch 18/33
Verifying : 2:vim-common-7.4.629-8.el7_9.x86_64 19/33
Verifying : perl-Scalar-List-Utils-1.27-248.el7.x86_64 20/33
Verifying : perl-Pod-Usage-1.63-3.el7.noarch 21/33
Verifying : perl-Encode-2.51-7.el7.x86_64 22/33
Verifying : perl-Pod-Perldoc-3.20-4.el7.noarch 23/33
Verifying : perl-podlators-2.5.1-3.el7.noarch 24/33
Verifying : 4:perl-5.16.3-299.el7_9.x86_64 25/33
Verifying : perl-File-Path-2.09-2.el7.noarch 26/33
Verifying : perl-threads-1.87-4.el7.x86_64 27/33
Verifying : 4:perl-Time-HiRes-1.9725-3.el7.x86_64 28/33
Verifying : gpm-libs-1.20.7-6.el7.x86_64 29/33
Verifying : perl-Filter-1.49-3.el7.x86_64 30/33
Verifying : perl-Getopt-Long-2.40-3.el7.noarch 31/33
Verifying : perl-Text-ParseWords-3.29-4.el7.noarch 32/33
Verifying : 4:perl-libs-5.16.3-299.el7_9.x86_64 33/33
Installed:
vim-enhanced.x86_64 2:7.4.629-8.el7_9
Dependency Installed:
gpm-libs.x86_64 0:1.20.7-6.el7 groff-base.x86_64 0:1.22.2-8.el7 perl.x86_64 4:5.16.3-299.el7_9
perl-Carp.noarch 0:1.26-244.el7 perl-Encode.x86_64 0:2.51-7.el7 perl-Exporter.noarch 0:5.68-3.el7
perl-File-Path.noarch 0:2.09-2.el7 perl-File-Temp.noarch 0:0.23.01-3.el7 perl-Filter.x86_64 0:1.49-3.el7
perl-Getopt-Long.noarch 0:2.40-3.el7 perl-HTTP-Tiny.noarch 0:0.033-3.el7 perl-PathTools.x86_64 0:3.40-5.el7
perl-Pod-Escapes.noarch 1:1.04-299.el7_9 perl-Pod-Perldoc.noarch 0:3.20-4.el7 perl-Pod-Simple.noarch 1:3.28-4.el7
perl-Pod-Usage.noarch 0:1.63-3.el7 perl-Scalar-List-Utils.x86_64 0:1.27-248.el7 perl-Socket.x86_64 0:2.010-5.el7
perl-Storable.x86_64 0:2.45-3.el7 perl-Text-ParseWords.noarch 0:3.29-4.el7 perl-Time-HiRes.x86_64 4:1.9725-3.el7
perl-Time-Local.noarch 0:1.2300-2.el7 perl-constant.noarch 0:1.27-2.el7 perl-libs.x86_64 4:5.16.3-299.el7_9
perl-macros.x86_64 4:5.16.3-299.el7_9 perl-parent.noarch 1:0.225-244.el7 perl-podlators.noarch 0:2.5.1-3.el7
perl-threads.x86_64 0:1.87-4.el7 perl-threads-shared.x86_64 0:1.43-6.el7 vim-common.x86_64 2:7.4.629-8.el7_9
vim-filesystem.x86_64 2:7.4.629-8.el7_9 which.x86_64 0:2.20-7.el7
Complete!
2.提交容器
①查询容器记录
[root@node1 ~]
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
680cce5c0b5f centos:7.8.2003 "bash" 2 minutes ago Exited (0) 5 seconds ago amazing_shockley
ac598bc79e84 nginx "/docker-entrypoint.…" 8 minutes ago Up 8 minutes 0.0.0.0:49153->80/tcp, :::49153->80/tcp web001
eee0a7682471 nginx "/docker-entrypoint.…" 13 minutes ago Up 13 minutes 0.0.0.0:85->80/tcp, :::85->80/tcp web
35153eebda77 nginx "/docker-entrypoint.…" 21 minutes ago Exited (130) 18 minutes ago happy_jang
91abb153df28 centos:7.8.2003 "ping baidu.com" 45 minutes ago Up 45 minutes suspicious_hoover
09792427acc4 centos:7.8.2003 "ping baidu.com" 48 minutes ago Exited (0) 48 minutes ago nervous_banzai
aec6f916a630 centos:7.8.2003 "ping baidu.com" 49 minutes ago Exited (0) 49 minutes ago pensive_clarke
6ad4643c4447 centos:7.8.2003 "ping www.baidu.com" 50 minutes ago Exited (2) 49 minutes ago objective_sutherland
dbbdd69a7944 centos:7.8.2003 "bash" 52 minutes ago Exited (0) 52 minutes ago friendly_haslett
d01b358d1736 centos "/bin/bash" 54 minutes ago Exited (0) 54 minutes ago gallant_williamson
2db168499262 redis "docker-entrypoint.s…" 25 hours ago Up 25 hours 6379/tcp, 0.0.0.0:8021->8021/tcp, :::8021->8021/tcp cool_ganguly
7bbc90aa1235 nginx "/docker-entrypoint.…" 25 hours ago Created relaxed_brahmagupta
2d9e649a84a2 opensuse "/bin/bash" 25 hours ago Exited (0) 25 hours ago objective_mcnulty
731daf4ecc83 opensuse "bash" 25 hours ago Exited (0) 25 hours ago serene_herschel
5bb956ef369a opensuse "bash" 25 hours ago Exited (0) 25 hours ago vibrant_hopper
fd583c3fba25 fedora "bash" 25 hours ago Exited (0) 25 hours ago practical_tharp
43d6bca30131 centos "bash" 25 hours ago Exited (0) 25 hours ago charming_nightingale
c2e14edd678d ubuntu "bash" 25 hours ago Exited (0) 25 hours ago gracious_robinson
273f0fc6a18c nginx "/docker-entrypoint.…" 26 hours ago Created 0.0.0.0:80->80/tcp, :::80->80/tcp relaxed_bassi
68076e397891 nginx "/docker-entrypoint.…" 26 hours ago Created 0.0.0.0:80->80/tcp, :::80->80/tcp crazy_bardeen
964648a939b9 nginx "/docker-entrypoint.…" 27 hours ago Created condescending_panini
②提交容器
[root@node1 ~]
sha256:91e91af846d6274f50cd3b07192793688861a99c1b0f5b5e3fcf2a4ceff6ba3e
[root@node1 ~]
REPOSITORY TAG IMAGE ID CREATED SIZE
ittest/centos-vim-7.8.2003 latest 91e91af846d6 6 seconds ago 386MB
ubuntu latest c29284518f49 8 days ago 72.8MB
nginx latest 4cdc5dd7eaad 2 weeks ago 133MB
redis latest 08502081bff6 4 weeks ago 105MB
fedora latest 055b2e5ebc94 2 months ago 178MB
centos latest 300e315adb2f 7 months ago 209MB
centos 7.8.2003 afb6fca791e0 14 months ago 203MB
opensuse latest d9e50bf28896 2 years ago 111MB
3.使用生成新镜像
[root@node1 ~]
[root@66968c4a8f0e /]
[root@66968c4a8f0e /]
hello!
|