Docker查看正在运行的容器目录的实现方式
[root@iZbp1dg7mun11n29b6ndm6Z ~]# docker inspect rabbitmq
[
{
"Id": "75c688fade05cf116c219c98a3291681b31bd594bdee9e20ca4356de2be49d54",
"Created": "2023-01-29T08:19:31.81602453Z",
"Path": "docker-entrypoint.sh",
"Args": [
"rabbitmq-server"
],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 29543,
"ExitCode": 0,
"Error": "",
"StartedAt": "2023-01-30T06:22:19.848560278Z",
"FinishedAt": "2023-01-30T06:22:14.562177701Z"
},
"Image": "sha256:d445c0adc9a5596c50e5b73b8b636f79de24ad9da00671714aea768b3fa4ee9b",
"ResolvConfPath": "/var/lib/docker/containers/75c688fade05cf116c219c98a3291681b31bd594bdee9e20ca4356de2be49d54/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/75c688fade05cf116c219c98a3291681b31bd594bdee9e20ca4356de2be49d54/hostname",
"HostsPath": "/var/lib/docker/containers/75c688fade05cf116c219c98a3291681b31bd594bdee9e20ca4356de2be49d54/hosts",
"LogPath": "/var/lib/docker/containers/75c688fade05cf116c219c98a3291681b31bd594bdee9e20ca4356de2be49d54/75c688fade05cf116c219c98a3291681b31bd594bdee9e20ca4356de2be49d54-json.log",
"Name": "/rabbitmq",
"RestartCount": 0,
"Driver": "overlay2",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": null,
"HostConfig": {
"Binds": null,
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "default",
"PortBindings": {
"15672/tcp": [
{
"HostIp": "",
"HostPort": "15672"
}
],
"5672/tcp": [
{
"HostIp": "",
"HostPort": "5672"
}
]
},
"RestartPolicy": {
"Name": "always",
"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/346e18c0e8e1bc04f3be2d7c848dbedd25ddd63639ff41ce6e19c8936e711db6-init/diff:/var/lib/docker/overlay2/d1f57dc40a37ea144eda52008ce77c6a204315fd463503ebb44d738f9def02d6/diff:/var/lib/docker/overlay2/94e59be20d43ea92c6db5d340e4e487aa48173f4c437ac301cf3020231ef53df/diff:/var/lib/docker/overlay2/91ebb4d307f75386fbfa2c870770cebba9f9cec0e88c3204758386bd7231b0f9/diff:/var/lib/docker/overlay2/26ae282efeabcfc1e1b0b487a2550d7ca1504048e58fd6a244835b9616b9b3af/diff:/var/lib/docker/overlay2/55d42966a32b217c6b97ac2b04fe56a8b1434538c78abda79a1fe01cef7d7570/diff:/var/lib/docker/overlay2/b37a30724d2e5cda683b3646dfdaa589661da410e29331fd5d0396eb9a5aaa29/diff:/var/lib/docker/overlay2/487d3efd72670cb9762b0d7abc407f152f5bf39a5777cf353fc325bd79acbf19/diff:/var/lib/docker/overlay2/9bbf703d2ce4a6d1d78cc443297250cca265a1a1204620eabe104358372b5e4a/diff:/var/lib/docker/overlay2/925b67bb37abd8a6d62c5188e66f0bd28d308d10274e13ccf88bb9d1449a1fb6/diff",
"MergedDir": "/var/lib/docker/overlay2/346e18c0e8e1bc04f3be2d7c848dbedd25ddd63639ff41ce6e19c8936e711db6/merged",
"UpperDir": "/var/lib/docker/overlay2/346e18c0e8e1bc04f3be2d7c848dbedd25ddd63639ff41ce6e19c8936e711db6/diff",
"WorkDir": "/var/lib/docker/overlay2/346e18c0e8e1bc04f3be2d7c848dbedd25ddd63639ff41ce6e19c8936e711db6/work"
},
"Name": "overlay2"
},
"Mounts": [
{
"Type": "volume",
"Name": "ad29726ea314115baebd50cab42b12676e5074dd90b48a4a87dcda7be5da7849",
"Source": "/var/lib/docker/volumes/ad29726ea314115baebd50cab42b12676e5074dd90b48a4a87dcda7be5da7849/_data",
"Destination": "/var/lib/rabbitmq",
"Driver": "local",
"Mode": "",
"RW": true,
"Propagation": ""
}
],
"Config": {
"Hostname": "rabbitmq",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"15672/tcp": {},
"15691/tcp": {},
"15692/tcp": {},
"25672/tcp": {},
"4369/tcp": {},
"5671/tcp": {},
"5672/tcp": {}
},
"Tty": false,
"OpenStdin": true,
"StdinOnce": false,
"Env": [
"PATH=/opt/rabbitmq/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"OPENSSL_VERSION=1.1.1m",
"OPENSSL_SOURCE_SHA256=f89199be8b23ca45fc7cb9f1d8d3ee67312318286ad030f5316aca6462db6c96",
"OPENSSL_PGP_KEY_IDS=0x8657ABB260F056B1E5190839D9C4D26D0E604491 0x5B2545DAB21995F4088CEFAA36CEE4DEB00CFE33 0xED230BEC4D4F2518B9D7DF41F0DB4D21C1D35231 0xC1F33DD8CE1D4CC613AF14DA9195C48241FBF7DD 0x7953AC1FBC3DC8B3B292393ED5E9E43F7DF9EE8C 0xE5E52560DD91C556DDBDA5D02064C53641C25E5D",
"OTP_VERSION=24.2",
"OTP_SOURCE_SHA256=af0f1928dcd16cd5746feeca8325811865578bf1a110a443d353ea3e509e6d41",
"RABBITMQ_DATA_DIR=/var/lib/rabbitmq",
"RABBITMQ_VERSION=3.9.11",
"RABBITMQ_PGP_KEY_ID=0x0A9AF2115F4687BD29803A206B73A36E6026DFCA",
"RABBITMQ_HOME=/opt/rabbitmq",
"RABBITMQ_LOGS=-",
"HOME=/var/lib/rabbitmq",
"LANG=C.UTF-8",
"LANGUAGE=C.UTF-8",
"LC_ALL=C.UTF-8"
],
"Cmd": [
"rabbitmq-server"
],
"Image": "rabbitmq",
"Volumes": {
"/var/lib/rabbitmq": {}
},
"WorkingDir": "",
"Entrypoint": [
"docker-entrypoint.sh"
],
"OnBuild": null,
"Labels": {}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "58608bd980cd569828f65ee1dbb3d86ece25313520d0a13b4d713c2207056d2b",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"15672/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "15672"
},
{
"HostIp": "::",
"HostPort": "15672"
}
],
"15691/tcp": null,
"15692/tcp": null,
"25672/tcp": null,
"4369/tcp": null,
"5671/tcp": null,
"5672/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "5672"
},
{
"HostIp": "::",
"HostPort": "5672"
}
]
},
"SandboxKey": "/var/run/docker/netns/58608bd980cd",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "6129ccc527280178c4be39392eae262820f3dde58bb79080292ff4e4d8df2ef3",
"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": "de078644f985fd6525e1562f58f81aa149f6e8d6fc2ed67fa648493e078e41b1",
"EndpointID": "6129ccc527280178c4be39392eae262820f3dde58bb79080292ff4e4d8df2ef3",
"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
}
}
}
}
]