Docker容器没有响应任何内容

时间:2017-06-19 07:00:18

标签: docker

我在Docker中遇到了一个重大问题。我docker ps之后:

docker ps
CONTAINER ID        IMAGE                          COMMAND                  CREATED             STATUS                        PORTS                                                                                                NAMES
15f3bfef906f        jaguar_celery                  "bash -c 'celery -..."   7 weeks ago         Up 3 days                                                                                                                          jaguar_celery_1

显然它正在运行,但是当我docker exec -it 15f3bfef906f bash时。这是结果:

rpc error: code = 2 desc = oci runtime error: exec failed: cannot exec a container that has run and stopped

我尝试重新启动容器但是当我重新启动STATUS时仍然是up 3 days

我甚至尝试停止过容器,但是在 docker ps

之后,变速器仍然存在 似乎什么都没有改变!

这就是我的码头工具统计信息中发生的事情

CONTAINER           CPU %               MEM USAGE / LIMIT       MEM %               NET I/O             BLOCK I/O           PIDS
15f3bfef906f        --                  -- / --                 --                  --                  --                  --

请帮忙!我不知道该怎么办

更新

docker检查输出

[
    {
        "Id": "15f3bfef906fb455f5eff42e8793b0325fb5a3cd679c2d338b589fe0c6ac9d5d",
        "Created": "2017-04-29T07:08:50.005736988Z",
        "Path": "bash",
        "Args": [
            "-c",
            "celery -A jaguar worker -Q create_account -l info & celery -A jaguar worker -B -Q others,login,get_balance,delete_expire -l info"
        ],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 4494,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2017-06-15T09:27:22.617660265Z",
            "FinishedAt": "2017-06-15T09:27:21.570596108Z"
        },
        "Image": "sha256:a4488611c50db37ab312b233fbf8c303e23b4b8ae6eb7636258dc7a4d778e35c",
        "ResolvConfPath": "/var/lib/docker/containers/15f3bfef906fb455f5eff42e8793b0325fb5a3cd679c2d338b589fe0c6ac9d5d/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/15f3bfef906fb455f5eff42e8793b0325fb5a3cd679c2d338b589fe0c6ac9d5d/hostname",
        "HostsPath": "/var/lib/docker/containers/15f3bfef906fb455f5eff42e8793b0325fb5a3cd679c2d338b589fe0c6ac9d5d/hosts",
        "LogPath": "/var/lib/docker/containers/15f3bfef906fb455f5eff42e8793b0325fb5a3cd679c2d338b589fe0c6ac9d5d/15f3bfef906fb455f5eff42e8793b0325fb5a3cd679c2d338b589fe0c6ac9d5d-json.log",
        "Name": "/jaguar_celery_1",
        "RestartCount": 0,
        "Driver": "aufs",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": [
            "d0f45df60131c3082e74c2ce4cc0c967582e2d46cfa6916e4b171e8696992312",
            "570f4b49b7e064139712bf0181db713718433a610132452a19cfefcd027dbe3d",
            "1de4fab499857408c4004b73356f6e4c5d1167c1dd0d26494b816b76dfe8447c",
            "05e502caee3b5e75a6a363f3c347dc2ca741ebe74cffcc23c00605681dc4a75a",
            "60db3ff3277a073f3f6ba6f1b566670586f796847150023dfaf8b956f6525d6c",
            "a0b8a4ed4c0cdb2a9ba6f284ddffa83993e13c454f233e2632419bf5b91a2d2e",
            "4fdceed8ba654f6817a782edb050dc1efe988353247038ef57a9d71252c26811",
            "76824c7dc33173733dccad250e9a8a5d3769a90e0f95e3516ec157e54ed16230",
            "c8bb4a9255b80760e4520d805fb2797b5c82a33942251767828192c477b3ee47",
            "83d161f716fd8352ecaa8c0da06a653a9c20b1efd20a1c5b53720484821e230d",
            "f58b2797b4206b588955b7a22ff3ab5b64358b89e4e98b3b18bcf765da818443",
            "1bafd9b0527c1a252797929d8208027c7ad8333600e8401935ec01c084933f1d"
        ],
        "HostConfig": {
            "Binds": [],
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "default",
            "PortBindings": {},
            "RestartPolicy": {
                "Name": "",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": [
                "4a9c4193082aa0051937789c37dc923db5e93277e0ebea3a85d3852922f2235a:rw"
            ],
            "CapAdd": null,
            "CapDrop": null,
            "Dns": [],
            "DnsOptions": [],
            "DnsSearch": [],
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "",
            "Cgroup": "",
            "Links": [
                "/jaguar_postgres_1:/jaguar_celery_1/jaguar_postgres_1",
                "/jaguar_postgres_1:/jaguar_celery_1/postgres",
                "/jaguar_postgres_1:/jaguar_celery_1/postgres_1",
                "/jaguar_redis_1:/jaguar_celery_1/jaguar_redis_1",
                "/jaguar_redis_1:/jaguar_celery_1/redis",
                "/jaguar_redis_1:/jaguar_celery_1/redis_1"
            ],
            "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": null,
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": null,
            "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": "aufs",
            "Data": null
        },
        "Mounts": [
            {
                "Name": "67a4d02521de864af1dc28be604edb153f933c08e4f4342971935dbae32d4756",
                "Source": "/var/lib/docker/volumes/67a4d02521de864af1dc28be604edb153f933c08e4f4342971935dbae32d4756/_data",
                "Destination": "/usr/logs",
                "Driver": "local",
                "Mode": "",
                "RW": true,
                "Propagation": ""
            },
            {
                "Name": "16fcd0464a2f886994f6763c45925e778707704bfdb2734499fd944675ec062a",
                "Source": "/var/lib/docker/volumes/16fcd0464a2f886994f6763c45925e778707704bfdb2734499fd944675ec062a/_data",
                "Destination": "/usr/src/app",
                "Driver": "local",
                "Mode": "",
                "RW": true,
                "Propagation": ""
            },
            {
                "Name": "20b9d5fcbb71502c9d543de43f541252308dbf075d27364f38ba7b6ede885a23",
                "Source": "/var/lib/docker/volumes/20b9d5fcbb71502c9d543de43f541252308dbf075d27364f38ba7b6ede885a23/_data",
                "Destination": "/usr/src/app/static",
                "Driver": "local",
                "Mode": "",
                "RW": true,
                "Propagation": ""
            }
        ],
        "Config": {
            "Hostname": "15f3bfef906f",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PGDATABASE=postgres",
                "CDN_HOSTNAME=http://xxxwe.net",
                "HTTPS=on",
                "PGHOST=postgres",
                "DB_PORT=5432",
                "DB_PASS=xxxx",
                "PGPASSWORD=xxxx",
                "DB_NAME=postgres",
                "AWS_BUCKET_NAME=xxxx",
                "ENV=production",
                "AWS_PREFIX_FILE_NAME=production",
                "AWS_ACCESS_KEY_ID=xxxx",
                "SITE_PREFIX=vnsr",
                "COMPOSE_PROJECT_NAME=jaguar",
                "WHITELIST=13.75.28.94:8001",
                "AWS_REGION=ap-southeast-1",
                "AWS_FOLDER_NAME=jaguar",
                "PGUSER=postgres",
                "DB_USER=postgres",
                "PGPORT=5432",
                "AWS_SECRET_ACCESS_KEY=xxxxx",
                "DB_SERVICE=postgres",
                "PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "LANG=C.UTF-8",
                "GPG_KEY=C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF",
                "PYTHON_VERSION=2.7.13",
                "PYTHON_PIP_VERSION=9.0.1"
            ],
            "Cmd": [
                "bash",
                "-c",
                "celery -A jaguar worker -Q create_account -l info & celery -A jaguar worker -B -Q others,login,get_balance,delete_expire -l info"
            ],
            "Image": "jaguar_celery",
            "Volumes": null,
            "WorkingDir": "/usr/src/app",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": {
                "com.docker.compose.config-hash": "7bff2a0b095ff5ea0574567fde47eeb8d9217d455519624a39def2eb96519292",
                "com.docker.compose.container-number": "1",
                "com.docker.compose.oneoff": "False",
                "com.docker.compose.project": "jaguar",
                "com.docker.compose.service": "celery",
                "com.docker.compose.version": "1.11.2"
            }
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "c8e514625a90f509702aefea38c8453f280ed51fde5fbd90a202c5b3ec8661b5",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {},
            "SandboxKey": "/var/run/docker/netns/c8e514625a90",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "7b22bcba1268f144ec4ec22ed33c0c4f6c47ffa2b98bd4ebcad9d78bf94867a6",
            "Gateway": "172.17.0.1",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "172.17.0.3",
            "IPPrefixLen": 16,
            "IPv6Gateway": "",
            "MacAddress": "02:42:ac:11:00:03",
            "Networks": {
                "bridge": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID": "ad82d85d7724ae87ca3f72337b275997ae95a56691aea406d79c38082f97fe07",
                    "EndpointID": "7b22bcba1268f144ec4ec22ed33c0c4f6c47ffa2b98bd4ebcad9d78bf94867a6",
                    "Gateway": "172.17.0.1",
                    "IPAddress": "172.17.0.3",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:ac:11:00:03"
                }
            }
        }
    }
]

Docker信息

Containers: 8
 Running: 7
 Paused: 0
 Stopped: 1
Images: 39
Server Version: 1.13.1
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 115
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins: 
 Volume: local
 Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: aa8187dbd3b7ad67d8e5e3a15115d3eef43a7ed1
runc version: 9df8b306d01f59d3a8029be411de015b7304dd8f
init version: 949e6fa
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.4.0-79-generic
Operating System: Ubuntu 16.04.1 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 27.48 GiB
Name: vnsr
ID: C5UR:5IDL:OV5K:4UTS:3XMZ:2MI7:PVYH:M5MF:32PZ:5QC6:TSG7:5DXC
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
WARNING: No swap limit support
Labels:
 provider=azure
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

4 个答案:

答案 0 :(得分:1)

你是否也可以尝试在exec命令bash中运行而不是ps uax来查看celery是否运行以及它消耗了多少CPU /内存?

此外,如果您运行docker logs -f 15f3bfef906f以查看芹菜队列中发生的情况以及可能导致此行为的原因,请检查会发生什么。

阅读您的评论并查看问题: https://github.com/moby/moby/issues/25381

可能存在不同的问题,例如一位用户写道:

  

我在尝试执行容器时遇到此错误,我的情况也是因为在thinpool中没有足够的空间。

     

lvs显示在swarm中的所有服务器上的thinpool中都有一些空间,但exec在我运行后开始工作:

/usr/bin/docker rmi `/usr/bin/docker images -qa`

但是你可能需要将docker降级到以前的版本。

我建议仔细阅读这些问题:

似乎有助于一个用户无法为另一个用户工作。

答案 1 :(得分:1)

看起来这可能是a bug,Docker版本大约为1.12。您是否需要从此容器中获取特定数据,或者为什么重新启动此容器不正常?

答案 2 :(得分:1)

检查docker是否正在运行:

systemctl status docker

如果死了,则强制在第一次启动时运行:

systemctl enable docker

然后启动它:

systemctl start docker

答案 3 :(得分:0)

首先检查容器状态 码头工人ps -a

对我来说,状态已退出。然后启动并附加容器

docker start -i“我的容器ID”。

完成。编码愉快