如何查看docker容器运行进程信息

 更新时间:2024年01月17日 15:43:00   作者: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"
                }
            }
        }
    }
]

总结

以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。

相关文章

  • Docker容器中Mysql数据的导入/导出详解

    Docker容器中Mysql数据的导入/导出详解

    服务器在使用了 Docker 后,对于备份和恢复数据库的事情做下记录,下面这篇文章主要给大家介绍了Docker容器中Mysql数据导入/导出的相关资料,文中通过示例代码介绍的非常详细,需要的朋友可以参考下
    2018-09-09
  • WIN10系统和Docker内部容器IP互通方式

    WIN10系统和Docker内部容器IP互通方式

    这篇文章主要介绍了WIN10系统和Docker内部容器IP互通方式,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
    2020-11-11
  • 解决Docker容器下不能使用vim命令的问题

    解决Docker容器下不能使用vim命令的问题

    这篇文章介绍了解决Docker容器下不能使用vim命令的问题,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
    2022-03-03
  • Docker数据存储总结

    Docker数据存储总结

    今天小编就为大家分享一篇关于Docker数据存储总结,小编觉得内容挺不错的,现在分享给大家,具有很好的参考价值,需要的朋友一起跟随小编来看看吧
    2019-02-02
  • Docker容器实战之镜像仓库

    Docker容器实战之镜像仓库

    这篇文章主要介绍了Docker容器实战之镜像仓库,文章通过Docker Hub为例,讲解关于镜像仓库的使用,需要的小伙伴可以参考一下
    2022-05-05
  • docker容器使用GPU方法实现

    docker容器使用GPU方法实现

    本文主要介绍了docker容器使用GPU方法实现,文中通过示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
    2022-05-05
  • Docker 教程之仓库配置文件详解

    Docker 教程之仓库配置文件详解

    这篇文章主要介绍了Docker 教程之仓库配置文件详解的相关资料,需要的朋友可以参考下
    2016-12-12
  • docker安装tomcat dubbo-admin实例技巧

    docker安装tomcat dubbo-admin实例技巧

    在本篇文章里小编给大家整理的是关于docker安装tomcat dubbo-admin实例技巧,有需要的朋友们可以参考下。
    2020-01-01
  • 如何使用Docker快速搭建服务器环境

    如何使用Docker快速搭建服务器环境

    这篇文章主要介绍了使用Docker快速搭建服务器环境的详细步骤,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下
    2023-10-10
  • docker安装tomcat并部署Springboot项目war包的方法

    docker安装tomcat并部署Springboot项目war包的方法

    这篇文章主要介绍了docker安装tomcat并部署Springboot项目war包的方法,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下
    2020-11-11

最新评论