下列为一个基本的运行docker镜像文件
xml
{
"Id": "62a82b0e69930e54c291095f632adde58dd0b247adba3a048385a55c87e38eba",
"Created": "2024-07-11T04:00:09.36091853Z",
"Path": "java",
"Args": [
"-jar",
"maku-generator-server.jar",
"--spring.datasource.url=jdbc:mysql://host.docker.internal:3306/maku_generator?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true"
],
"State": {
"Status": "exited",
"Running": false,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 0,
"ExitCode": 143,
"Error": "",
"StartedAt": "2024-08-14T09:01:17.352355112Z",
"FinishedAt": "2024-08-14T09:01:22.086400171Z"
},
"Image": "sha256:b35f89cd19d3e6e51375db52afae00e6667e57bf011c732f792022eb8a132916",
"ResolvConfPath": "/var/lib/docker/containers/62a82b0e69930e54c291095f632adde58dd0b247adba3a048385a55c87e38eba/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/62a82b0e69930e54c291095f632adde58dd0b247adba3a048385a55c87e38eba/hostname",
"HostsPath": "/var/lib/docker/containers/62a82b0e69930e54c291095f632adde58dd0b247adba3a048385a55c87e38eba/hosts",
"LogPath": "/var/lib/docker/containers/62a82b0e69930e54c291095f632adde58dd0b247adba3a048385a55c87e38eba/62a82b0e69930e54c291095f632adde58dd0b247adba3a048385a55c87e38eba-json.log",
"Name": "/gen",
"RestartCount": 0,
"Driver": "overlay2",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": null,
"HostConfig": {
"Binds": null,
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "default",
"PortBindings": {
"8088/tcp": [
{
"HostIp": "",
"HostPort": "8088"
}
]
},
"RestartPolicy": {
"Name": "no",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": null,
"ConsoleSize": [
22,
163
],
"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",
"Isolation": "",
"CpuShares": 0,
"Memory": 0,
"NanoCpus": 0,
"CgroupParent": "",
"BlkioWeight": 0,
"BlkioWeightDevice": [],
"BlkioDeviceReadBps": [],
"BlkioDeviceWriteBps": [],
"BlkioDeviceReadIOps": [],
"BlkioDeviceWriteIOps": [],
"CpuPeriod": 0,
"CpuQuota": 0,
"CpuRealtimePeriod": 0,
"CpuRealtimeRuntime": 0,
"CpusetCpus": "",
"CpusetMems": "",
"Devices": [],
"DeviceCgroupRules": null,
"DeviceRequests": null,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": null,
"OomKillDisable": false,
"PidsLimit": null,
"Ulimits": [],
"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",
"/sys/devices/virtual/powercap"
],
"ReadonlyPaths": [
"/proc/bus",
"/proc/fs",
"/proc/irq",
"/proc/sys",
"/proc/sysrq-trigger"
]
},
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/3cdebcd1d9491c9a14c77a0db52f910629a31384e39ccc6d4853866d9eaaa79d-init/diff:/var/lib/docker/overlay2/56luuqfrswuz7x6td1fygfivh/diff:/var/lib/docker/overlay2/ce6lmn5j7bhtuwb3cqavde4at/diff:/var/lib/docker/overlay2/e9dc72b1d03bf23788aaf4cc3bf9d4609bb071d000e87d26dd48539d1400bff3/diff:/var/lib/docker/overlay2/7d739afcb052a148b6f17bd4caf00a0e32483897dd56b6b29e78b3917a533849/diff:/var/lib/docker/overlay2/f9f2b28bc59332b5675ee85cc92651460750662217b09e5cd68dfe4e1fa24c78/diff",
"MergedDir": "/var/lib/docker/overlay2/3cdebcd1d9491c9a14c77a0db52f910629a31384e39ccc6d4853866d9eaaa79d/merged",
"UpperDir": "/var/lib/docker/overlay2/3cdebcd1d9491c9a14c77a0db52f910629a31384e39ccc6d4853866d9eaaa79d/diff",
"WorkDir": "/var/lib/docker/overlay2/3cdebcd1d9491c9a14c77a0db52f910629a31384e39ccc6d4853866d9eaaa79d/work"
},
"Name": "overlay2"
},
"Mounts": [],
"Config": {
"Hostname": "62a82b0e6993",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": true,
"AttachStderr": true,
"ExposedPorts": {
"8088/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/java/openjdk-17/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"JAVA_HOME=/usr/java/openjdk-17",
"LANG=C.UTF-8",
"JAVA_VERSION=17.0.1"
],
"Cmd": [
"java",
"-jar",
"maku-generator-server.jar",
"--spring.datasource.url=jdbc:mysql://host.docker.internal:3306/maku_generator?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true"
],
"Image": "gen",
"Volumes": null,
"WorkingDir": "/app",
"Entrypoint": null,
"OnBuild": null,
"Labels": {}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "cc7661fa276fccf9cdd4d4a119b477a0ac80feeb646ac67f09de6611933cf716",
"SandboxKey": "/var/run/docker/netns/cc7661fa276f",
"Ports": {},
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "",
"Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"MacAddress": "",
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"MacAddress": "",
"NetworkID": "0acdefbf9bb407acdab598b39ac2a428dc0531eae4d9170c332b241d8e3b0969",
"EndpointID": "",
"Gateway": "",
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"DriverOpts": null,
"DNSNames": null
}
}
}
}
这段JSON数据描述了一个Docker容器的详细信息。下面是对关键部分的解读:
基本信息
- Id: 容器的唯一标识符,这里是62a82b0e69930e54c291095f632adde58dd0b247adba3a048385a55c87e38eba。
- Created: 容器创建时间,2024-07-11T04:00:09.36091853Z(UTC时间)。
- Path: 容器启动时执行的命令路径,这里是java。
- Args: 启动命令的参数,包括-jar maku-generator-server.jar和数据库连接字符串。
- Name: 容器的名称,这里是/gen。
状态信息
- State :
- Status: 容器的当前状态,这里是exited,表示容器已经停止运行。
- Running: 容器是否正在运行,这里是false。
- ExitCode: 容器退出时的状态码,这里是143,通常表示容器被信号(如SIGTERM)终止。
- StartedAt 和 FinishedAt: 容器开始和结束运行的时间。
镜像信息
- Image: 容器使用的镜像ID,这里是sha256:b35f89cd19d3e6e51375db52afae00e6667e57bf011c732f792022eb8a132916。
- Config :
- Cmd: 容器启动时执行的命令和参数,与Args相同。
- Env: 环境变量设置,包括PATH、JAVA_HOME等。
- WorkingDir: 容器内的工作目录,这里是/app。
网络配置
- NetworkSettings :
- Networks: 容器连接的网络信息,这里只有一个名为bridge的网络,但没有具体的IP地址信息。
存储配置
- GraphDriver :
- Data: 描述了存储驱动(这里是overlay2)的详细信息,包括LowerDir、MergedDir、UpperDir和WorkDir,这些是overlay2存储驱动管理文件系统层的方式。
其他配置
- HostConfig :
- PortBindings: 端口绑定信息,这里将容器的8088端口映射到宿主机的8088端口。
- RestartPolicy: 重启策略,这里是no,表示容器不会在退出后自动重启。
- AutoRemove: 是否在容器停止后自动删除,这里是false。
日志和路径信息
- LogPath: 容器日志文件的路径,这里是/var/lib/docker/containers/62a82b0e69930e54c291095f632adde58dd0b247adba3a048385a55c87e38eba/62a82b0e69930e54c291095f632adde58dd0b247adba3a048385a55c87e38eba-json.log。
- ResolvConfPath 、HostnamePath 、HostsPath: 分别指向容器的DNS配置、主机名配置和主机文件路径。
资源和安全限制
- Driver 、Platform 、MountLabel 、ProcessLabel 、AppArmorProfile等字段提供了关于容器运行时环境和安全策略的信息。
注意事项
- Mounts: 空的数组,表示没有额外的挂载点。
- ExecIDs: 空的字段,表示没有执行过额外的命令。