docker XML详解

下列为一个基本的运行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)终止。
    • StartedAtFinishedAt: 容器开始和结束运行的时间。

镜像信息

  • 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。
  • ResolvConfPathHostnamePathHostsPath: 分别指向容器的DNS配置、主机名配置和主机文件路径。

资源和安全限制

  • DriverPlatformMountLabelProcessLabelAppArmorProfile等字段提供了关于容器运行时环境和安全策略的信息。

注意事项

  • Mounts: 空的数组,表示没有额外的挂载点。
  • ExecIDs: 空的字段,表示没有执行过额外的命令。
相关推荐
惜.己19 小时前
Jmeter中的断言(二)
测试工具·jmeter·1024程序员节
西电研梦1 天前
考研倒计时30天丨和西电一起向前!再向前!
人工智能·考研·1024程序员节·西电·西安电子科技大学
惜.己1 天前
Jmeter中的断言(四)
测试工具·jmeter·1024程序员节
·云扬·2 天前
Java IO 与 BIO、NIO、AIO 详解
java·开发语言·笔记·学习·nio·1024程序员节
网安_秋刀鱼2 天前
PHP代码审计 --MVC模型开发框架&rce示例
开发语言·web安全·网络安全·php·mvc·1024程序员节
HUODUNYUN2 天前
小程序免备案:快速部署与优化的全攻略
服务器·网络·web安全·小程序·1024程序员节
惜.己2 天前
Jmeter的后置处理器(二)
测试工具·github·1024程序员节
惜.己3 天前
Jmeter中的断言(一)
测试工具·jmeter·1024程序员节
cainiao0806053 天前
《物理学进展》
1024程序员节·核心期刊·知网期刊·职称评审
FFDUST3 天前
C++ —— string类(上)
c语言·开发语言·数据结构·c++·stl·1024程序员节