当前位置:   article > 正文

docker 日志,元数据以及进程的查看_docker 元数据

docker 元数据

大家好,今天我们来分享docker 日志,元数据以及进程的查看

在这之前,我们来讲一次docker其它的命令

启动容器并在后台运行

[root@localhost ~]# docker run  -d centos /bin/bash
76a165f7d1a8469fe3de519c3eb5a1dd5fe1af759ecdbee6c69b82a756379972
[root@localhost ~]# 
  • 1
  • 2
  • 3

查看一下正在运行的容器:

在这里插入图片描述

发现并没有,因为在后台运行,前台认为没有

这样写,就正常了
在这里插入图片描述
所以,docker在后台运行的同时,必须要有一个前台的进程 -it 选项可以解决这个问题

查看docker 日志:

[root@localhost ~]# docker logs      
  • 1

docker日志的帮助文档:

在这里插入图片描述

[root@localhost ~]# docker logs  -f -t  --tail 10 39fb3756e692     //查看日志


  • 1
  • 2
  • 3

因为它默认没有东西 ,所以我们写个shell 脚本

[root@localhost ~]# docker run -d centos /bin/sh -c "while true:do echo shuaige :sleep 1;done"
  • 1

在这里插入图片描述

查看docker 进程

docker top 
  • 1

在这里插入图片描述

查看docker镜像的元数据(详细详细)

[root@localhost ~]# docker inspect 39fb3756e692

[
    {
        "Id": "39fb3756e6921dbdbf433edf09b3b2f3a79ce4bc47f7a53f740809f95f22b057",
        "Created": "2022-03-07T03:35:57.051465703Z",
        "Path": "/bin/bash",
        "Args": [],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 75984,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2022-03-07T03:35:57.523365016Z",
            "FinishedAt": "0001-01-01T00:00:00Z"
        },
        "Image": "sha256:5d0da3dc976460b72c77d94c8a1ad043720b0416bfc16c52c45d4847e53fadb6",
        "ResolvConfPath": "/var/lib/docker/containers/39fb3756e6921dbdbf433edf09b3b2f3a79ce4bc47f7a53f740809f95f22b057/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/39fb3756e6921dbdbf433edf09b3b2f3a79ce4bc47f7a53f740809f95f22b057/hostname",
        "HostsPath": "/var/lib/docker/containers/39fb3756e6921dbdbf433edf09b3b2f3a79ce4bc47f7a53f740809f95f22b057/hosts",
        "LogPath": "/var/lib/docker/containers/39fb3756e6921dbdbf433edf09b3b2f3a79ce4bc47f7a53f740809f95f22b057/39fb3756e6921dbdbf433edf09b3b2f3a79ce4bc47f7a53f740809f95f22b057-json.log",
        "Name": "/affectionate_ardinghelli",
        "RestartCount": 0,
        "Driver": "overlay2",
        "Platform": "linux",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": null,
        "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,
            "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",
            "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/4bef2946d4172c56e16e7308e8a8424246619643778c673dc0830c3afcf66f19-init/diff:/var/lib/docker/overlay2/454e365eaabadd8ad35c2f7c315ef80806f8c14929d09a94ad618b721d4494e2/diff",
                "MergedDir": "/var/lib/docker/overlay2/4bef2946d4172c56e16e7308e8a8424246619643778c673dc0830c3afcf66f19/merged",
                "UpperDir": "/var/lib/docker/overlay2/4bef2946d4172c56e16e7308e8a8424246619643778c673dc0830c3afcf66f19/diff",
                "WorkDir": "/var/lib/docker/overlay2/4bef2946d4172c56e16e7308e8a8424246619643778c673dc0830c3afcf66f19/work"
            },
            "Name": "overlay2"
        },
        "Mounts": [],
        "Config": {
            "Hostname": "39fb3756e692",
            "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",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": {
                "org.label-schema.build-date": "20210915",
                "org.label-schema.license": "GPLv2",
                "org.label-schema.name": "CentOS Base Image",
                "org.label-schema.schema-version": "1.0",
                "org.label-schema.vendor": "CentOS"
            }
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "830b1412536466696cfc3ca24508ed84ccc531598cd33d35d5238eeae50b1a81",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {},
            "SandboxKey": "/var/run/docker/netns/830b14125364",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "5f29c2d2ba2399cf7522045b86dc12e18e5f26f2dcc999831570436d6df2a6f5",
            "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": "7f8c174757a8669a54ea4894d7b07d13f32683e685af1adb758e67944738fb93",
                    "EndpointID": "5f29c2d2ba2399cf7522045b86dc12e18e5f26f2dcc999831570436d6df2a6f5",
                    "Gateway": "172.17.0.1",
                    "IPAddress": "172.17.0.2",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:ac:11:00:02",
                    "DriverOpts": null
                }
            }
        }
    }
]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202

它的创建时间

在这里插入图片描述

这是镜像的来源:
在这里插入图片描述

这是挂载,目前还没有做
在这里插入图片描述

这是它的环境配置

在这里插入图片描述

这是它的cmd 命令

在这里插入图片描述
这是这个镜像的网络信息
在这里插入图片描述
好了,有关于docker 日志,元数据以及进程的查看,就到这里了,谢谢大家

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/1016184
推荐阅读
相关标签
  

闽ICP备14008679号