91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

docker怎么查看容器啟動命令

發布時間:2023-02-22 10:34:38 來源:億速云 閱讀:99 作者:iii 欄目:開發技術

本篇內容介紹了“docker怎么查看容器啟動命令”的有關知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠學有所成!

eg:

docker ps 查看正在運行的容器:

docker怎么查看容器啟動命令

通過docker ps命令

該命令主要是為了詳細展示查看運行時的command參數

docker ps -a --no-trunc | grep container_name   # 通過docker --no-trunc參數來詳細展示容器運行命令

docker怎么查看容器啟動命令

通過docker inspect命令

使用docker inspect,但是docker inspect打印的是json文件,需要挑選字段查看,容器的參數信息都能從json文件中解析出來。

1,在容器外部,物理機上,可以用下面命令

docker inspect <container_name>   # 可以是container_name或者container_id

eg:

[root@128 ~]# docker ps
CONTAINER ID   IMAGE          COMMAND                  CREATED          STATUS          PORTS                                                  NAMES
547880f43cf1   mysql:8.0.31   "docker-entrypoint.s…"   15 minutes ago   Up 15 minutes   33060/tcp, 0.0.0.0:3301->3306/tcp, :::3301->3306/tcp   mysql-8.0.31
e02f22dc442c   mysql:5.7      "docker-entrypoint.s…"   25 hours ago     Up 18 minutes   0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp   mysql
[root@128 ~]# docker ps -a --no-trunc | grep 547880f43cf1
547880f43cf176d2a826ae26f9f04bbe637ca56ec5d92df25a78d24ec23ed232   mysql:8.0.31          "docker-entrypoint.sh mysqld"                          15 minutes ago   Up 15 minutes                 33060/tcp, 0.0.0.0:3301->3306/tcp, :::3301->3306/tcp   mysql-8.0.31
[root@128 ~]# docker inspect 547880f43cf1
[
    {
        "Id": "547880f43cf176d2a826ae26f9f04bbe637ca56ec5d92df25a78d24ec23ed232",
        "Created": "2022-12-07T10:13:46.80942044Z",
        "Path": "docker-entrypoint.sh",
        "Args": [
            "mysqld"
        ],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 5469,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2022-12-07T10:13:47.159621124Z",
            "FinishedAt": "0001-01-01T00:00:00Z"
        },
        "Image": "sha256:a3a2968869cf080dbbd2adaac9e4075cc358b50a1451ff5e2b9ae90551a4735f",
        "ResolvConfPath": "/var/lib/docker/containers/547880f43cf176d2a826ae26f9f04bbe637ca56ec5d92df25a78d24ec23ed232/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/547880f43cf176d2a826ae26f9f04bbe637ca56ec5d92df25a78d24ec23ed232/hostname",
        "HostsPath": "/var/lib/docker/containers/547880f43cf176d2a826ae26f9f04bbe637ca56ec5d92df25a78d24ec23ed232/hosts",
        "LogPath": "/var/lib/docker/containers/547880f43cf176d2a826ae26f9f04bbe637ca56ec5d92df25a78d24ec23ed232/547880f43cf176d2a826ae26f9f04bbe637ca56ec5d92df25a78d24ec23ed232-json.log",
        "Name": "/mysql-8.0.31",
        "RestartCount": 0,
        "Driver": "overlay2",
        "Platform": "linux",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": [
                "/mydata/mysql-8.0.31/log:/var/log/mysql",
                "/mydata/mysql-8.0.31/data:/var/lib/mysql"
            ],
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "default",
            "PortBindings": {
                "3306/tcp": [
                    {
                        "HostIp": "",
                        "HostPort": "3301"
                    }
                ]
            },
            "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/b4d5fed9eb97224cd6834e36509728032ceac386e863a483d7e2770f611eb8d1-init/diff:/var/lib/docker/overlay2/e6ce4810d05ed0bdca975287151d5edcb8f5b4e3472fba848ecbd0858a83c27d/diff:/var/lib/docker/overlay2/0bd4abf22bc8fd1840c48d50034d525576608654eac3696820bdecca885869e1/diff:/var/lib/docker/overlay2/aa9ffa3d8ca28910870afed61cbb7a8b5954b633b6c51ddec94b33f45fd7c69a/diff:/var/lib/docker/overlay2/7832e98417573f093c97491e70941e1a09e9a6e4e49b4407644cc367fdbeb37e/diff:/var/lib/docker/overlay2/74b73e21fc743a650a4064f4e771fd65aca511cf433aee93cc6eef2f3a91d787/diff:/var/lib/docker/overlay2/0df122c8a1629d74c09d97e489932b0812da34d28734118287934acbf3e8e985/diff:/var/lib/docker/overlay2/6f48c0c0c5bb4f2d96900b9eb4d20409a066a9bf3c104171e5dd33f28dbe6301/diff:/var/lib/docker/overlay2/37869951120d01076a5bc57e0c04c8f466a0b0b37e06357653b27b2fc9638a1d/diff:/var/lib/docker/overlay2/c2414c698ebdc9f0bacedf53387c75aa6cb000720ff019d989e4daa9d9c0929f/diff:/var/lib/docker/overlay2/099e69b07f239a7747f754a2598aec804655f5d6d7beb9ffb85932c490ec13d1/diff:/var/lib/docker/overlay2/9be3057383e74825462c49286ffa30853fb87f6d975ad40459e12972538ce21c/diff",
                "MergedDir": "/var/lib/docker/overlay2/b4d5fed9eb97224cd6834e36509728032ceac386e863a483d7e2770f611eb8d1/merged",
                "UpperDir": "/var/lib/docker/overlay2/b4d5fed9eb97224cd6834e36509728032ceac386e863a483d7e2770f611eb8d1/diff",
                "WorkDir": "/var/lib/docker/overlay2/b4d5fed9eb97224cd6834e36509728032ceac386e863a483d7e2770f611eb8d1/work"
            },
            "Name": "overlay2"
        },
        "Mounts": [
            {
                "Type": "bind",
                "Source": "/mydata/mysql-8.0.31/log",
                "Destination": "/var/log/mysql",
                "Mode": "",
                "RW": true,
                "Propagation": "rprivate"
            },
            {
                "Type": "bind",
                "Source": "/mydata/mysql-8.0.31/data",
                "Destination": "/var/lib/mysql",
                "Mode": "",
                "RW": true,
                "Propagation": "rprivate"
            }
        ],
        "Config": {
            "Hostname": "547880f43cf1",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "3306/tcp": {},
                "33060/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "MYSQL_ROOT_PASSWORD=123456",
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "GOSU_VERSION=1.14",
                "MYSQL_MAJOR=8.0",
                "MYSQL_VERSION=8.0.31-1.el8",
                "MYSQL_SHELL_VERSION=8.0.31-1.el8"
            ],
            "Cmd": [
                "mysqld"
            ],
            "Image": "mysql:8.0.31",
            "Volumes": {
                "/var/lib/mysql": {}
            },
            "WorkingDir": "",
            "Entrypoint": [
                "docker-entrypoint.sh"
            ],
            "OnBuild": null,
            "Labels": {}
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "f82246141707b2ab4578ce193cdf42b9dd82fef9d8ca805c4b07b6af90867ffc",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {
                "3306/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "3301"
                    },
                    {
                        "HostIp": "::",
                        "HostPort": "3301"
                    }
                ],
                "33060/tcp": null
            },
            "SandboxKey": "/var/run/docker/netns/f82246141707",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "386a6348d0fd2e9119e7d427ed2df21bf03f4a88c485b50cf142d6c0b0f08f83",
            "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": "65f89f72b915b6ae63526860f40f2e701bfcc1c689301d757230f7a522379d35",
                    "EndpointID": "386a6348d0fd2e9119e7d427ed2df21bf03f4a88c485b50cf142d6c0b0f08f83",
                    "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
                }
            }
        }
    }
]

如上所示,這個是我這547880f43cf1 容器的詳細信息

然后可以定制化輸出上面的信息:顯示上面內容的某一部分信息

docker inspect --format='{{.NetworkSettings.Networks.bridge.IPAddress}}' <container_name>      # format是go語言的template,還有其他的用法
docker inspect --format='{{.Mounts}}' <container_name>   
docker inspect --format='{{.HostConfig.Binds}}' <container_name>
docker inspect --format='{{.HostConfig.PortBindings}}' <container_name>

eg: 還可以將上面的修改為別的內容,我這邊關注file和port兩個

[root@128 ~]# docker ps
CONTAINER ID   IMAGE          COMMAND                  CREATED          STATUS          PORTS                                                  NAMES
547880f43cf1   mysql:8.0.31   "docker-entrypoint.s…"   18 minutes ago   Up 18 minutes   33060/tcp, 0.0.0.0:3301->3306/tcp, :::3301->3306/tcp   mysql-8.0.31
e02f22dc442c   mysql:5.7      "docker-entrypoint.s…"   25 hours ago     Up 22 minutes   0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp   mysql
[root@128 ~]# docker inspect --format='{{.Mounts}}' 547880f43cf1
[{bind  /mydata/mysql-8.0.31/log /var/log/mysql   true rprivate} {bind  /mydata/mysql-8.0.31/data /var/lib/mysql   true rprivate}]
[root@128 ~]# docker inspect --format='{{.NetworkSettings.Networks.bridge.IPAddress}}' 547880f43cf1
172.17.0.2
[root@128 ~]# docker inspect --format='{{.HostConfig.Binds}}' 547880f43cf1
[/mydata/mysql-8.0.31/log:/var/log/mysql /mydata/mysql-8.0.31/data:/var/lib/mysql]
[root@128 ~]# docker inspect --format='{{.HostConfig.PortBindings}}' 547880f43cf1
map[3306/tcp:[{ 3301}]]
[root@128 ~]#

“docker怎么查看容器啟動命令”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業相關的知識可以關注億速云網站,小編將為大家輸出更多高質量的實用文章!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

澄江县| 蒙自县| 永嘉县| 周至县| 吴忠市| 阳曲县| 铁岭市| 江口县| 定陶县| 巨鹿县| 比如县| 承德县| 乐山市| 金门县| 肃宁县| 铜梁县| 曲阳县| 商河县| 南投市| 百色市| 修武县| 通州区| 齐河县| 浠水县| 崇州市| 泸西县| 玉溪市| 德江县| 桂东县| 莱西市| 枣阳市| 扬中市| 襄垣县| 油尖旺区| 叙永县| 江西省| 福清市| 宝清县| 嘉义县| 宜都市| 泽普县|