Docker "Gracefully stopping" 本身在 `docker-compose up` 期间而不是 `docker-compose 运行 --entrypoint`
Docker "Gracefully stopping" itself during `docker-compose up` but not `docker-compose run --entrypoint`
当我用 docker-compose up
启动一个 Docker 容器时,它会像往常一样启动,但最终容器会自动退出,但在冗长的日志中没有任何有用的信息。
当我使用相同的 docker-compose.yml
配置(具有相同的入口点集)和相同的 Docker 文件代替 运行 docker-compose up --entrypoint run-tests.sh
时,Docker容器自己说 "Gracefully stopping" 并停止所有容器。
不良行为似乎来自 运行ning docker-compose up
而不是等效的 docker-compose run
.
容器在关闭之前似乎会停留不同的时间。在一个实例中它停留了 7 分钟,在其他情况下则不同。
有人知道如何解决这个问题吗?
Docker 版本:
Docker version 1.9.0, build 76d6bc9
docker-compose version: 1.5.0
docker-machine version 0.5.0 (HEAD)
docker-compose --verbose up
日志:
docker-compose --verbose --project-name monkeycore up monkeycore-autotest
... lots of startup log (let me know if you need to see this) ...
# Scala Play1 Framework tests, not likely relevant
monkeycore-autotest_1 | ~ MonkeyTest... PASSED 30s
monkeycore-autotest_1 | ~ WhateverDataTest... PASSED 33s
monkeycore-autotest_1 | ~ SauceTest... PASSED 1 min 44s
Gracefully stopping... (press Ctrl+C again to force)
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=False, filters={u'label': [u'com.docker.compose.project=monkeycore', u'com.docker.compose.oneoff=False']})
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 2 items)
compose.cli.verbose_proxy.proxy_callable: docker inspect_container <- (u'617bf28c3f7ae3779f383f7e2a96f66e552e92f755a15d07ac6b73329ba3860f')
compose.cli.verbose_proxy.proxy_callable: docker inspect_container -> {u'AppArmorProfile': u'',
u'Args': [u'-c', u'build.sh && play auto-test'],
u'Config': {u'AttachStderr': False,
u'AttachStdin': False,
u'AttachStdout': False,
u'Cmd': None,
u'CpuShares': 0,
u'Cpuset': u'',
u'Domainname': u'',
u'Entrypoint': [u'bash', u'-c', u'build.sh && play auto-test'],
...
compose.cli.verbose_proxy.proxy_callable: docker inspect_container <- (u'4963e9287ed10d587a79f57a52eaf86c07c6947b2119072bd5d68a3ed0eb161e')
compose.cli.verbose_proxy.proxy_callable: docker inspect_container -> {u'AppArmorProfile': u'',
u'Args': [u'/usr/local/etc/redis/redis.conf'],
u'Config': {u'AttachStderr': False,
u'AttachStdin': False,
u'AttachStdout': False,
u'Cmd': None,
u'CpuShares': 0,
u'Cpuset': u'',
u'Domainname': u'',
u'Entrypoint': [u'redis-server',
...
Stopping monkeycore_monkeycore-autotest_1 ...
compose.cli.verbose_proxy.proxy_callable: docker stop <- (u'617bf28c3f7ae3779f383f7e2a96f66e552e92f755a15d07ac6b73329ba3860f', timeout=10)
Stopping monkeycore_monkeycore-autotest_1 ... done
ERROR: compose.cli.main.main: Couldn't connect to Docker daemon - you might need to run `docker-machine start default`.
docker-compose.yml
:
monkeycore-base:
build: ../
dockerfile: "docker/monkeycore/Dockerfile"
ports:
- "8000:8000"
- "8082:8082"
- "9000:9000"
stdin_open: true
tty: true
working_dir: "/path/to/dir"
volumes:
- src:dest
environment:
LOTS_OF_ENVIRONMENT_VARIABLES: "defined"
monkeycore-autotest:
extends:
service: monkeycore-base
links:
- redis
entrypoint: "run-tests.sh"
redis:
build: ./redis
ports:
- "6379:6379"
出于某种原因,您的 docker 客户端与您的 docker 引擎失去了联系。可能 monkeycore_monkeycore-autotest_1 容器上的一些问题导致了它。
检查您的 docker 机器是否仍然 运行ning:
$ docker machine ls
如果设置了 envs 变量,'docker' 变量:
env | grep -i "docker"
尝试重新启动您的 docker-机器,重置您的环境变量
eval "$(docker-machine env default)" ### or your machine name.
并尝试 运行 在容器内手动测试 (docker exec -ti container-name /bin/bash
) 以查看那里出了什么问题。
我遇到了同样的问题。在 Compose 的存储库中有一个 open issue。
在这个问题中,有人建议 运行 docker-compose up -d
作为解决方法。这样即使连接失败,容器也会保持 运行ning。
要查看容器日志,只需 运行 docker-compose logs
.
该建议暂时解决了问题,无需担心降级 Compose。
当我用 docker-compose up
启动一个 Docker 容器时,它会像往常一样启动,但最终容器会自动退出,但在冗长的日志中没有任何有用的信息。
当我使用相同的 docker-compose.yml
配置(具有相同的入口点集)和相同的 Docker 文件代替 运行 docker-compose up --entrypoint run-tests.sh
时,Docker容器自己说 "Gracefully stopping" 并停止所有容器。
不良行为似乎来自 运行ning docker-compose up
而不是等效的 docker-compose run
.
容器在关闭之前似乎会停留不同的时间。在一个实例中它停留了 7 分钟,在其他情况下则不同。
有人知道如何解决这个问题吗?
Docker 版本:
Docker version 1.9.0, build 76d6bc9
docker-compose version: 1.5.0
docker-machine version 0.5.0 (HEAD)
docker-compose --verbose up
日志:
docker-compose --verbose --project-name monkeycore up monkeycore-autotest
... lots of startup log (let me know if you need to see this) ...
# Scala Play1 Framework tests, not likely relevant
monkeycore-autotest_1 | ~ MonkeyTest... PASSED 30s
monkeycore-autotest_1 | ~ WhateverDataTest... PASSED 33s
monkeycore-autotest_1 | ~ SauceTest... PASSED 1 min 44s
Gracefully stopping... (press Ctrl+C again to force)
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=False, filters={u'label': [u'com.docker.compose.project=monkeycore', u'com.docker.compose.oneoff=False']})
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 2 items)
compose.cli.verbose_proxy.proxy_callable: docker inspect_container <- (u'617bf28c3f7ae3779f383f7e2a96f66e552e92f755a15d07ac6b73329ba3860f')
compose.cli.verbose_proxy.proxy_callable: docker inspect_container -> {u'AppArmorProfile': u'',
u'Args': [u'-c', u'build.sh && play auto-test'],
u'Config': {u'AttachStderr': False,
u'AttachStdin': False,
u'AttachStdout': False,
u'Cmd': None,
u'CpuShares': 0,
u'Cpuset': u'',
u'Domainname': u'',
u'Entrypoint': [u'bash', u'-c', u'build.sh && play auto-test'],
...
compose.cli.verbose_proxy.proxy_callable: docker inspect_container <- (u'4963e9287ed10d587a79f57a52eaf86c07c6947b2119072bd5d68a3ed0eb161e')
compose.cli.verbose_proxy.proxy_callable: docker inspect_container -> {u'AppArmorProfile': u'',
u'Args': [u'/usr/local/etc/redis/redis.conf'],
u'Config': {u'AttachStderr': False,
u'AttachStdin': False,
u'AttachStdout': False,
u'Cmd': None,
u'CpuShares': 0,
u'Cpuset': u'',
u'Domainname': u'',
u'Entrypoint': [u'redis-server',
...
Stopping monkeycore_monkeycore-autotest_1 ...
compose.cli.verbose_proxy.proxy_callable: docker stop <- (u'617bf28c3f7ae3779f383f7e2a96f66e552e92f755a15d07ac6b73329ba3860f', timeout=10)
Stopping monkeycore_monkeycore-autotest_1 ... done
ERROR: compose.cli.main.main: Couldn't connect to Docker daemon - you might need to run `docker-machine start default`.
docker-compose.yml
:
monkeycore-base:
build: ../
dockerfile: "docker/monkeycore/Dockerfile"
ports:
- "8000:8000"
- "8082:8082"
- "9000:9000"
stdin_open: true
tty: true
working_dir: "/path/to/dir"
volumes:
- src:dest
environment:
LOTS_OF_ENVIRONMENT_VARIABLES: "defined"
monkeycore-autotest:
extends:
service: monkeycore-base
links:
- redis
entrypoint: "run-tests.sh"
redis:
build: ./redis
ports:
- "6379:6379"
出于某种原因,您的 docker 客户端与您的 docker 引擎失去了联系。可能 monkeycore_monkeycore-autotest_1 容器上的一些问题导致了它。
检查您的 docker 机器是否仍然 运行ning:
$ docker machine ls
如果设置了 envs 变量,'docker' 变量:
env | grep -i "docker"
尝试重新启动您的 docker-机器,重置您的环境变量
eval "$(docker-machine env default)" ### or your machine name.
并尝试 运行 在容器内手动测试 (docker exec -ti container-name /bin/bash
) 以查看那里出了什么问题。
我遇到了同样的问题。在 Compose 的存储库中有一个 open issue。
在这个问题中,有人建议 运行 docker-compose up -d
作为解决方法。这样即使连接失败,容器也会保持 运行ning。
要查看容器日志,只需 运行 docker-compose logs
.
该建议暂时解决了问题,无需担心降级 Compose。