我的守护程序docker容器没有继续运行

时间:2016-01-15 12:46:32

标签: docker

有新手简单问题。我在我的Windows 10 64bit机器上安装了docker工具箱,我之前更新了我的虚拟机箱5.0.12当前。

尝试james turnbull的书中的一些简单的docker示例 - 但是运行deamon ubuntu图像会立即停止运行,我不知道为什么。

我运行docker cli并输入以下内容

docker run --name daemon_ubuntu_will  -d ubuntu /bin/sh -c "while true; do 
echo hello world; sleep 1;done"

这会返回long id并返回命令提示符,但是如果我运行

docker ps

什么都没有运行,如果我运行

docker ps -a 

它显示容器已存在但状态已停止。

运行docker inspect daemon_ubuntu_will

[
{
    "Id": "57a133f1b3414d1945de0be1d17b4609d774e2602acdfe22b17fe4eacd495458",
    "Created": "2016-01-15T12:19:24.223715466Z",
    "Path": "/bin/bash",
    "Args": [],
    "State": {
        "Status": "exited",
        "Running": false,
        "Paused": false,
        "Restarting": false,
        "OOMKilled": false,
        "Dead": false,
        "Pid": 0,
        "ExitCode": 0,
        "Error": "",
        "StartedAt": "2016-01-15T12:19:24.274741496Z",
        "FinishedAt": "2016-01-15T12:19:24.295086672Z"
    },
    "Image": "c4bea91afef3764163fd506f5c1090be1d34a9b63ece81867cb863455937048e",
    "ResolvConfPath": "/mnt/sda1/var/lib/docker/containers/57a133f1b3414d1945de0be1d17b4609d774e2602acdfe22b17fe4eacd495458/resolv.conf",
    "HostnamePath": "/mnt/sda1/var/lib/docker/containers/57a133f1b3414d1945de0be1d17b4609d774e2602acdfe22b17fe4eacd495458/hostname",
    "HostsPath": "/mnt/sda1/var/lib/docker/containers/57a133f1b3414d1945de0be1d17b4609d774e2602acdfe22b17fe4eacd495458/hosts",
    "LogPath": "/mnt/sda1/var/lib/docker/containers/57a133f1b3414d1945de0be1d17b4609d774e2602acdfe22b17fe4eacd495458/57a133f1b3414d1945de0be1d17b4609d774e2602acdfe22b17fe4eacd495458-json.log",
    "Name": "/daemon_ubuntu_will",
    "RestartCount": 0,
    "Driver": "aufs",
    "ExecDriver": "native-0.2",
    "MountLabel": "",
    "ProcessLabel": "",
    "AppArmorProfile": "",
    "ExecIDs": null,
    "HostConfig": {
        "Binds": null,
        "ContainerIDFile": "",
        "LxcConf": [],
        "Memory": 0,
        "MemoryReservation": 0,
        "MemorySwap": 0,
        "KernelMemory": 0,
        "CpuShares": 0,
        "CpuPeriod": 0,
        "CpusetCpus": "",
        "CpusetMems": "",
        "CpuQuota": 0,
        "BlkioWeight": 0,
        "OomKillDisable": false,
        "MemorySwappiness": -1,
        "Privileged": false,
        "PortBindings": {},
        "Links": null,
        "PublishAllPorts": false,
        "Dns": [],
        "DnsOptions": [],
        "DnsSearch": [],
        "ExtraHosts": null,
        "VolumesFrom": null,
        "Devices": [],
        "NetworkMode": "default",
        "IpcMode": "",
        "PidMode": "",
        "UTSMode": "",
        "CapAdd": null,
        "CapDrop": null,
        "GroupAdd": null,
        "RestartPolicy": {
            "Name": "no",
            "MaximumRetryCount": 0
        },
        "SecurityOpt": null,
        "ReadonlyRootfs": false,
        "Ulimits": null,
        "LogConfig": {
            "Type": "json-file",
            "Config": {}
        },
        "CgroupParent": "",
        "ConsoleSize": [
            25,
            155
        ],
        "VolumeDriver": ""
    },
    "GraphDriver": {
        "Name": "aufs",
        "Data": null
    },
    "Mounts": [],
    "Config": {
        "Hostname": "57a133f1b341",
        "Domainname": "",
        "User": "",
        "AttachStdin": false,
        "AttachStdout": false,
        "AttachStderr": false,
        "Tty": false,
        "OpenStdin": false,
        "StdinOnce": false,
        "Env": null,
        "Cmd": [
            "/bin/bash"
        ],
        "Image": "ubuntu",
        "Volumes": null,
        "WorkingDir": "",
        "Entrypoint": null,
        "OnBuild": null,
        "Labels": {},
        "StopSignal": "15"
    },
    "NetworkSettings": {
        "Bridge": "",
        "SandboxID": "",
        "HairpinMode": false,
        "LinkLocalIPv6Address": "",
        "LinkLocalIPv6PrefixLen": 0,
        "Ports": null,
        "SandboxKey": "",
        "SecondaryIPAddresses": null,
        "SecondaryIPv6Addresses": null,
        "EndpointID": "",
        "Gateway": "",
        "GlobalIPv6Address": "",
        "GlobalIPv6PrefixLen": 0,
        "IPAddress": "",
        "IPPrefixLen": 0,
        "IPv6Gateway": "",
        "MacAddress": "",
        "Networks": {
            "bridge": {
                "EndpointID": "",
                "Gateway": "",
                "IPAddress": "",
                "IPPrefixLen": 0,
                "IPv6Gateway": "",
                "GlobalIPv6Address": "",
                "GlobalIPv6PrefixLen": 0,
                "MacAddress": ""
            }
        }
    }
}
]

为什么守护程序服务器不能保持运行状态?

我可以使用

非常愉快地运行交互式容器
docker run --name mymachine -i -t ubuntu /bin/sh

任何人都可以提出我做错的事吗?

0 个答案:

没有答案