1、docker 版本

[root@localhost netns]# docker version
Client: Docker Engine - Community
Version: 19.03.5
API version: 1.40
Go version: go1.12.12
Git commit: 633a0ea
Built: Wed Nov 13 07:25:41 2019
OS/Arch: linux/amd64
Experimental: false

Server: Docker Engine - Community
Engine:
Version: 19.03.5
API version: 1.40 (minimum version 1.12)
Go version: go1.12.12
Git commit: 633a0ea
Built: Wed Nov 13 07:24:18 2019
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.2.6
GitCommit: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc:
Version: 1.0.0-rc8
GitCommit: 425e105d5a03fabd737a126ad93d62a9eeede87f
docker-init:
Version: 0.18.0
GitCommit: fec3683
[root@localhost netns]#

 

2、显示当前运行的容器

[root@localhost netns]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3646dab192ee centos:centos8 "/bin/bash" 24 hours ago Up 24 hours my-centos2
737af37d1e9f centos "/bin/bash" 24 hours ago Up 24 hours my-centos1
adefd0beaa9d redis "docker-entrypoint.s…" 25 hours ago Up 25 hours 0.0.0.0:32769->6379/tcp my-redis
a7bb0b00049e nginx "nginx -g 'daemon of…" 25 hours ago Up 25 hours 0.0.0.0:32768->80/tcp my-nginx
b3d74694b08b busybox "/bin/sh -c 'while t…" 29 hours ago Up 29 hours my-busybox
[root@localhost netns]#

 

 

3、查看一个容器的详情

[root@localhost netns]# docker inspect 3646dab192ee | more
[
{
"Id": "3646dab192eebc3b019329ecb049ed0781e95b1cf58f516a16ff1733d675e9db",
"Created": "2020-02-01T07:39:42.577726602Z",
"Path": "/bin/bash",
"Args": [],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 27139,
"ExitCode": 0,
"Error": "",
"StartedAt": "2020-02-01T07:39:44.495883054Z",
"FinishedAt": "0001-01-01T00:00:00Z"
},
"Image": "sha256:470671670cac686c7cf0081e0b37da2e9f4f768ddc5f6a26102ccd1c6954c1ee",
"ResolvConfPath": "/var/lib/docker/containers/3646dab192eebc3b019329ecb049ed0781e95b1cf58f516a16ff1733d675e9db/resolv
.conf",
"HostnamePath": "/var/lib/docker/containers/3646dab192eebc3b019329ecb049ed0781e95b1cf58f516a16ff1733d675e9db/hostname
",
"HostsPath": "/var/lib/docker/containers/3646dab192eebc3b019329ecb049ed0781e95b1cf58f516a16ff1733d675e9db/hosts",
"LogPath": "/var/lib/docker/containers/3646dab192eebc3b019329ecb049ed0781e95b1cf58f516a16ff1733d675e9db/3646dab192eeb
c3b019329ecb049ed0781e95b1cf58f516a16ff1733d675e9db-json.log",
"Name": "/my-centos2",
"RestartCount": 0,
"Driver": "overlay2",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": [
"8670d47e11b6f265e949238c72d1ef3fa5b4628ed58a39f19cf2b0b20f9d369b"
],
"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/5f353a7fa0a3c2ff3704d3ad0292a6d60f8d74822eab0f1bf061b8eddb2a2571-init/d
iff:/var/lib/docker/overlay2/de883113bff61d508dc5d6b6005eb9c09eb49823bae437bfda49ba1affaa2871/diff",
"MergedDir": "/var/lib/docker/overlay2/5f353a7fa0a3c2ff3704d3ad0292a6d60f8d74822eab0f1bf061b8eddb2a2571/merge
d",
"UpperDir": "/var/lib/docker/overlay2/5f353a7fa0a3c2ff3704d3ad0292a6d60f8d74822eab0f1bf061b8eddb2a2571/diff",
"WorkDir": "/var/lib/docker/overlay2/5f353a7fa0a3c2ff3704d3ad0292a6d60f8d74822eab0f1bf061b8eddb2a2571/work"
},
"Name": "overlay2"
},
"Mounts": [],
"Config": {
"Hostname": "3646dab192ee",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": true,
"OpenStdin": true,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Cmd": [
"/bin/bash"
],
"Image": "centos:centos8",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": {
"org.label-schema.build-date": "20200114",
"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-01-14 00:00:00-08:00",
"org.opencontainers.image.licenses": "GPL-2.0-only",
"org.opencontainers.image.title": "CentOS Base Image",
"org.opencontainers.image.vendor": "CentOS"
}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "9c13361cc96886b0915ed96874cbdcf5685066393c0642c8b8dceaf2b91ee6d4",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {},
"SandboxKey": "/var/run/docker/netns/9c13361cc968",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "59acdb8d6733c52afa2440fb560cef1c479de343b65b9ae62f597804451a2629",
"Gateway": "172.17.0.1",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "172.17.0.6",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"MacAddress": "02:42:ac:11:00:06",
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "644f68d79900c3c93261cf2574d017168997982d108b7b92b6009800eaf948b2",
"EndpointID": "59acdb8d6733c52afa2440fb560cef1c479de343b65b9ae62f597804451a2629",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.6",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:11:00:06",
"DriverOpts": null
}
}
}
}
]
[root@localhost netns]#

posted on 2020-02-02 15:59  爱编程的小兵  阅读(9528)  评论(0编辑  收藏  举报