如何查看docker容器运行进程信息
作者:kevinsingapore
这篇文章主要介绍了如何查看docker容器运行进程信息问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教
查看docker容器运行进程信息
[root@fuqiang ~]# docker top grafana UID PID PPID C STIME TTY TIME CMD 472 28965 28946 0 Apr11 pts/1 00:01:28 grafana-server --homepath=/usr/share/grafana --config=/etc/grafana/grafana.ini --packaging=docker cfg:default.log.mode=console cfg:default.paths.data=/var/lib/grafana cfg:default.paths.logs=/var/log/grafana cfg:default.paths.plugins=/var/lib/grafana/plugins cfg:default.paths.provisioning=/etc/grafana/provisioning
以上:
1、得出grafana二进制文件目录;
2、得出grafana配置文件地址;
3、得出grafana日志文件地址;
查看docker容器更多详尽信息
[root@fuqiang ~]# docker inspect grafana [ { "Id": "6effe71fe7ec3b0ec36304f7c9320718e337a751e550aa3f8f6e85af0ced2023", "Created": "2019-04-11T15:06:21.201247754Z", "Path": "/run.sh", "Args": [], "State": { "Status": "running", "Running": true, "Paused": false, "Restarting": false, "OOMKilled": false, "Dead": false, "Pid": 28965, "ExitCode": 0, "Error": "", "StartedAt": "2019-04-11T15:06:22.023144219Z", "FinishedAt": "0001-01-01T00:00:00Z" }, "Image": "sha256:a8b0c77b00b7be157cfc8c97aea550166fca2582d0aab8f7f4ed60824a793165", "ResolvConfPath": "/var/lib/docker/containers/6effe71fe7ec3b0ec36304f7c9320718e337a751e550aa3f8f6e85af0ced2023/resolv.conf", "HostnamePath": "/var/lib/docker/containers/6effe71fe7ec3b0ec36304f7c9320718e337a751e550aa3f8f6e85af0ced2023/hostname", "HostsPath": "/var/lib/docker/containers/6effe71fe7ec3b0ec36304f7c9320718e337a751e550aa3f8f6e85af0ced2023/hosts", "LogPath": "", "Name": "/grafana", "RestartCount": 0, "Driver": "overlay2", "MountLabel": "", "ProcessLabel": "", "AppArmorProfile": "", "ExecIDs": null, "HostConfig": { "Binds": null, "ContainerIDFile": "", "LogConfig": { "Type": "journald", "Config": {} }, "NetworkMode": "default", "PortBindings": { "3000/tcp": [ { "HostIp": "", "HostPort": "3000" } ] }, "RestartPolicy": { "Name": "no", "MaximumRetryCount": 0 }, "AutoRemove": false, "VolumeDriver": "", "VolumesFrom": null, "CapAdd": null, "CapDrop": null, "Dns": [], "DnsOptions": [], "DnsSearch": [], "ExtraHosts": null, "GroupAdd": null, "IpcMode": "", "Cgroup": "", "Links": null, "OomScoreAdj": 0, "PidMode": "", "Privileged": false, "PublishAllPorts": false, "ReadonlyRootfs": false, "SecurityOpt": null, "UTSMode": "", "UsernsMode": "", "ShmSize": 67108864, "Runtime": "docker-runc", "ConsoleSize": [ 0, 0 ], "Isolation": "", "CpuShares": 0, "Memory": 0, "NanoCpus": 0, "CgroupParent": "", "BlkioWeight": 0, "BlkioWeightDevice": null, "BlkioDeviceReadBps": null, "BlkioDeviceWriteBps": null, "BlkioDeviceReadIOps": null, "BlkioDeviceWriteIOps": null, "CpuPeriod": 0, "CpuQuota": 0, "CpuRealtimePeriod": 0, "CpuRealtimeRuntime": 0, "CpusetCpus": "", "CpusetMems": "", "Devices": [], "DiskQuota": 0, "KernelMemory": 0, "MemoryReservation": 0, "MemorySwap": 0, "MemorySwappiness": -1, "OomKillDisable": false, "PidsLimit": 0, "Ulimits": null, "CpuCount": 0, "CpuPercent": 0, "IOMaximumIOps": 0, "IOMaximumBandwidth": 0 }, "GraphDriver": { "Name": "overlay2", "Data": { "LowerDir": "/var/lib/docker/overlay2/31ffb4fe9af54d7adad81b43c0e0db6312b6891fc97b20a44d96e9056bed9cb2-init/diff:/var/lib/docker/overlay2/eee1eb1d2c12ed4f6337855c69ced49f23c0bb5317557c442ac863be071c1631/diff:/var/lib/docker/overlay2/cc68ea8e1fc4e4484bed3e33f1cf8de1c7d99ad9da3d79c0aec820dfd3084625/diff:/var/lib/docker/overlay2/f9f95b541397f694fbbdff1197065b3674c3d6731179245b2ea508d8a124b435/diff:/var/lib/docker/overlay2/be770f9cd4f2496072a450f2c5cb42bd4cc3d65aeb2fbcd861bb5590d2e597a3/diff:/var/lib/docker/overlay2/59e4ab62c3aa6910fb7ac17b78c0530883116f58ebf3afa31b4f3b6e5d4b7787/diff:/var/lib/docker/overlay2/39890d8510be8543f2e6d2e2a57c4c9af9bae80d622967d78e88ebc6a768ce37/diff", "MergedDir": "/var/lib/docker/overlay2/31ffb4fe9af54d7adad81b43c0e0db6312b6891fc97b20a44d96e9056bed9cb2/merged", "UpperDir": "/var/lib/docker/overlay2/31ffb4fe9af54d7adad81b43c0e0db6312b6891fc97b20a44d96e9056bed9cb2/diff", "WorkDir": "/var/lib/docker/overlay2/31ffb4fe9af54d7adad81b43c0e0db6312b6891fc97b20a44d96e9056bed9cb2/work" } }, "Mounts": [], "Config": { "Hostname": "6effe71fe7ec", "Domainname": "", "User": "grafana", "AttachStdin": false, "AttachStdout": false, "AttachStderr": false, "ExposedPorts": { "3000/tcp": {} }, "Tty": true, "OpenStdin": true, "StdinOnce": false, "Env": [ "PATH=/usr/share/grafana/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "GF_PATHS_CONFIG=/etc/grafana/grafana.ini", "GF_PATHS_DATA=/var/lib/grafana", "GF_PATHS_HOME=/usr/share/grafana", "GF_PATHS_LOGS=/var/log/grafana", "GF_PATHS_PLUGINS=/var/lib/grafana/plugins", "GF_PATHS_PROVISIONING=/etc/grafana/provisioning" ], "Cmd": null, "ArgsEscaped": true, "Image": "docker.io/grafana/grafana", "Volumes": null, "WorkingDir": "/usr/share/grafana", "Entrypoint": [ "/run.sh" ], "OnBuild": null, "Labels": {} }, "NetworkSettings": { "Bridge": "", "SandboxID": "8bdefa83451a6e6f0741b2fe834edcb26c3b7dfa575d2e0b29cfc50fb6f0c834", "HairpinMode": false, "LinkLocalIPv6Address": "", "LinkLocalIPv6PrefixLen": 0, "Ports": { "3000/tcp": [ { "HostIp": "0.0.0.0", "HostPort": "3000" } ] }, "SandboxKey": "/var/run/docker/netns/8bdefa83451a", "SecondaryIPAddresses": null, "SecondaryIPv6Addresses": null, "EndpointID": "d9e8afaab5a5d7169c5f38b7ff96b4aaf765c2f08dd302c08877d02569e8edc0", "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": "25dd56e200165334b0efa736775cefab55db063ffabe274dd43d9d9a1f2dafd6", "EndpointID": "d9e8afaab5a5d7169c5f38b7ff96b4aaf765c2f08dd302c08877d02569e8edc0", "Gateway": "172.17.0.1", "IPAddress": "172.17.0.2", "IPPrefixLen": 16, "IPv6Gateway": "", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "MacAddress": "02:42:ac:11:00:02" } } } } ]
总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。