无法在Docker Toolbox中看到容器

问题描述 投票:1回答:1

我在Windows 10中安装了docker工具箱。我使用docker命令为应用程序创建了一个mysql容器。我能够创建它并且还能够使用docker container ls命令查看它,但这只是第一次。

关闭docker工具箱并重新打开它时会出现问题。当我发出docker container ls命令时,我无法找到我创建的任何容器。

但是当我试图检查容器时,我能够查看容器的详细信息。

附上容器的截图和json细节。

如有需要,请告知我们。

用于创建MySQL容器的Docker命令

docker run --name mysql-docker-petclinic -e MYSQL_ROOT_PASSWORD=admin -e MYSQL_DATABASE=petclinic -e MYSQL_USERNAME=root -e MYSQL_PASSWORD=admin -p 3306:3306 -d mysql:latest

检查命令详细信息

$ docker container inspect mysql-docker-petclinic
[
    {
        "Id": "f30f66154b7398bbfd1b65d34afc0d973ecdbe62d0e2cbd654003775d11499e0",
        "Created": "2018-02-25T16:28:10.327158448Z",
        "Path": "docker-entrypoint.sh",
        "Args": [
            "mysqld"
        ],
        "State": {
            "Status": "exited",
            "Running": false,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 0,
            "ExitCode": 255,
            "Error": "",
            "StartedAt": "2018-02-25T16:28:12.428822667Z",
            "FinishedAt": "2018-02-26T04:38:54.98958199Z"
        },
        "Image": "sha256:f0f3956a9dd825e3195f0d1a4fe17cc94b0f6934fc470b09abf8fad87d17ff24",
        "ResolvConfPath": "/mnt/sda1/var/lib/docker/containers/f30f66154b7398bbfd1b65d34afc0d973ecdbe62d0e2cbd654003775d11499e0/resolv.conf",
        "HostnamePath": "/mnt/sda1/var/lib/docker/containers/f30f66154b7398bbfd1b65d34afc0d973ecdbe62d0e2cbd654003775d11499e0/hostname",
        "HostsPath": "/mnt/sda1/var/lib/docker/containers/f30f66154b7398bbfd1b65d34afc0d973ecdbe62d0e2cbd654003775d11499e0/hosts",
        "LogPath": "/mnt/sda1/var/lib/docker/containers/f30f66154b7398bbfd1b65d34afc0d973ecdbe62d0e2cbd654003775d11499e0/f30f66154b7398bbfd1b65d34afc0d973ecdbe62d0e2cbd654003775d11499e0-json.log",
        "Name": "/mysql-docker-petclinic",
        "RestartCount": 0,
        "Driver": "aufs",
        "Platform": "linux",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": null,
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "default",
            "PortBindings": {
                "3306/tcp": [
                    {
                        "HostIp": "",
                        "HostPort": "3306"
                    }
                ]
            },
            "RestartPolicy": {
                "Name": "no",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "CapAdd": null,
            "CapDrop": null,
            "Dns": [],
            "DnsOptions": [],
            "DnsSearch": [],
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "shareable",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": null,
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 67108864,
            "Runtime": "runc",
            "ConsoleSize": [
                30,
                120
            ],
            "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,
            "DiskQuota": 0,
            "KernelMemory": 0,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": null,
            "OomKillDisable": false,
            "PidsLimit": 0,
            "Ulimits": null,
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0
        },
        "GraphDriver": {
            "Data": null,
            "Name": "aufs"
        },
        "Mounts": [
            {
                "Type": "volume",
                "Name": "7195ae34c4698fbcdf3737962e799e991e0268a33ea6126af8b0e4aa24b2b18e",
                "Source": "/mnt/sda1/var/lib/docker/volumes/7195ae34c4698fbcdf3737962e799e991e0268a33ea6126af8b0e4aa24b2b18e/_data",
                "Destination": "/var/lib/mysql",
                "Driver": "local",
                "Mode": "",
                "RW": true,
                "Propagation": ""
            }
        ],
        "Config": {
            "Hostname": "f30f66154b73",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "3306/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "MYSQL_ROOT_PASSWORD=admin",
                "MYSQL_DATABASE=petclinic",
                "MYSQL_USERNAME=root",
                "MYSQL_PASSWORD=admin",
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "GOSU_VERSION=1.7",
                "MYSQL_MAJOR=5.7",
                "MYSQL_VERSION=5.7.21-1debian8"
            ],
            "Cmd": [
                "mysqld"
            ],
            "ArgsEscaped": true,
            "Image": "mysql:latest",
            "Volumes": {
                "/var/lib/mysql": {}
            },
            "WorkingDir": "",
            "Entrypoint": [
                "docker-entrypoint.sh"
            ],
            "OnBuild": null,
            "Labels": {}
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "0f9a23a942344c2e7c23d425456787db327278dec4601447eb526dfdaa9c3abb",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {
                "3306/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "3306"
                    }
                ]
            },
            "SandboxKey": "/var/run/docker/netns/0f9a23a94234",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "*********************************************************",
            "Gateway": "172.17.0.1",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "172.17.0.2",
            "IPPrefixLen": 16,
            "IPv6Gateway": "",
            "MacAddress": "*********************************",
            "Networks": {
                "bridge": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID": "*********************************************************",
                    "EndpointID": "*********************************************************",
                    "Gateway": "172.17.0.1",
                    "IPAddress": "172.17.0.2",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "*********************************************************",
                    "DriverOpts": null
                }
            }
        }
    }
]

截图

1. Docker ls命令

enter image description here

2. Docker检查命令详细信息

enter image description here

-------------更新-------------

enter image description here

docker
1个回答
0
投票

docker container ls默认只显示正在运行的容器。

关闭docker工具箱并重新打开它

这意味着您的所有容器现在都处于“兴奋”状态。

尝试:

docker container ls --all

另见docker ps -a

© www.soinside.com 2019 - 2024. All rights reserved.