compose: Docker-compose up exiting with code 0

expected behaviour

start container and expose container bash

actual behaviour

starts up the container then exits the container shutting down the container

software/ hardware specs

Virtual box 5.0.24 Docker 1.2.11 Docker-compose version 1.8.0 OSX Yosemite

issue description

I’m trying to run a container using docker-compose via docker-compose.yml files but the process seems to start up the container and exits with a code 0 when running the command docker-compose -f docker-compose.yml -f docker-compose-dev.yml up . I really need to run some bash commands and live the container up and running here is my docker-compose.yml

services:
  ngcracealong-rsync:
    # command: ["watch","-n3","ls -la"]
    command: 'bash'
    # entrypoint: '/bin/bash'
    # entrypoint: "lein with-profile dev do start-dev"
    container_name: 'docker-clojurescript'
    environment:
      - TERM=xterm
      - COMPOSE_HTTP_TIMEOUT=200
      - DEBUG=true
    expose:
      - "3000"
      - "9000"
    image: rand/docker-clojurescript
    ports:
      - "3000:3000"
      - "9000:9000"
    working_dir: '/data'
    read_only: false
    privileged: true
    # tty: true
    # command: "/bin/bash ls -la"
version: '2'

in a docker-compose-dev.yml

services:
  ngcracealong-rsync:
    volumes:
      - ngcracealong-rsync-sync:/data:rw
version: '2'
volumes:
  ngcracealong-rsync-sync:
    external: true

trying to execute a command like ‘/bin/bash ls -l’ leads to some erroneous errors like ‘commands not found’ I can only assume that the commands are running before volumes are setup

a --verbose output yields

compose.config.config.find: Using configuration files: ./docker-compose.yml,./docker-compose-dev.yml docker.auth.auth.load_config: File doesn’t exist compose.cli.command.get_client: docker-compose version 1.8.0, build unknown docker-py version: 1.9.0 CPython version: 2.7.10 OpenSSL version: OpenSSL 0.9.8zh 14 Jan 2016 compose.cli.command.get_client: Docker base_url: https://192.168.99.103:2376 compose.cli.command.get_client: Docker version: KernelVersion=4.4.17-boot2docker, Os=linux, BuildTime=2016-08-18T17:52:38.255390991+00:00, ApiVersion=1.24, Version=1.12.1, GitCommit=23cf638, Arch=amd64, GoVersion=go1.6.3 compose.cli.verbose_proxy.proxy_callable: docker info <- () compose.cli.verbose_proxy.proxy_callable: docker info -> {u’Architecture’: u’x86_64’, u’BridgeNfIp6tables’: True, u’BridgeNfIptables’: True, u’CPUSet’: True, u’CPUShares’: True, u’CgroupDriver’: u’cgroupfs’, u’ClusterAdvertise’: u’‘, u’ClusterStore’: u’‘, u’Containers’: 4, u’ContainersPaused’: 0, … compose.cli.verbose_proxy.proxy_callable: docker inspect_network <- (u’ngcracealongdocker_default’) compose.cli.verbose_proxy.proxy_callable: docker inspect_network -> {u’Containers’: {}, u’Driver’: u’bridge’, u’EnableIPv6’: False, u’IPAM’: {u’Config’: [{u’Gateway’: u’172.18.0.1’, u’Subnet’: u’172.18.0.0/16’}], u’Driver’: u’default’, u’Options’: None}, u’Id’: u’bce4ac5ee716ed4b0b2b184632fd2a83423b78120fe51b9788d9b59ca248d669’, u’Internal’: False, u’Labels’: {}, … compose.cli.verbose_proxy.proxy_callable: docker inspect_volume <- (‘ngcracealong-rsync-sync’) compose.cli.verbose_proxy.proxy_callable: docker inspect_volume -> {u’Driver’: u’local’, u’Labels’: None, u’Mountpoint’: u’/mnt/sda1/var/lib/docker/volumes/ngcracealong-rsync-sync/_data’, u’Name’: u’ngcracealong-rsync-sync’, u’Scope’: u’local’} compose.volume.initialize: Volume ngcracealong-rsync-sync declared as external. No new volume will be created. compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=False, filters={u’label’: [u’com.docker.compose.project=ngcracealongdocker’, u’com.docker.compose.oneoff=False’]}) compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 0 items) compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=True, filters={u’label’: [u’com.docker.compose.project=ngcracealongdocker’, u’com.docker.compose.service=ngcracealong-rsync’, u’com.docker.compose.oneoff=False’]}) compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 1 items) compose.cli.verbose_proxy.proxy_callable: docker inspect_container <- (u’dfbae0eb3e7589786a8d9bf71bbe8a01cc22088cc88a4d0fa2b06fbccb29742d’) compose.cli.verbose_proxy.proxy_callable: docker inspect_container -> {u’AppArmorProfile’: u’‘, u’Args’: [u’with-profile’, u’dev’, u’do’, u’start-dev’], u’Config’: {u’AttachStderr’: False, u’AttachStdin’: False, u’AttachStdout’: False, u’Cmd’: None, u’Domainname’: u’‘, u’Entrypoint’: [u’lein’, u’with-profile’, u’dev’, … compose.cli.verbose_proxy.proxy_callable: docker inspect_image <- (‘rand/docker-clojurescript’) compose.cli.verbose_proxy.proxy_callable: docker inspect_image -> {u’Architecture’: u’amd64’, u’Author’: u’Rand Fitzpatrick rand.fitzpatrick@gmail.com’, u’Comment’: u’‘, u’Config’: {u’AttachStderr’: False, u’AttachStdin’: False, u’AttachStdout’: False, u’Cmd’: [u’bash’], u’Domainname’: u’‘, u’Entrypoint’: None, u’Env’: [u’PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin’, … compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=True, filters={u’label’: [u’com.docker.compose.project=ngcracealongdocker’, u’com.docker.compose.service=ngcracealong-rsync’, u’com.docker.compose.oneoff=False’]}) compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 1 items) compose.cli.verbose_proxy.proxy_callable: docker inspect_image <- (‘rand/docker-clojurescript’) compose.cli.verbose_proxy.proxy_callable: docker inspect_image -> {u’Architecture’: u’amd64’, u’Author’: u’Rand Fitzpatrick rand.fitzpatrick@gmail.com’, u’Comment’: u’‘, u’Config’: {u’AttachStderr’: False, u’AttachStdin’: False, u’AttachStdout’: False, u’Cmd’: [u’bash’], u’Domainname’: u’‘, u’Entrypoint’: None, u’Env’: [u’PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin’, … compose.cli.verbose_proxy.proxy_callable: docker inspect_container <- (u’dfbae0eb3e7589786a8d9bf71bbe8a01cc22088cc88a4d0fa2b06fbccb29742d’) compose.cli.verbose_proxy.proxy_callable: docker inspect_container -> {u’AppArmorProfile’: u’‘, u’Args’: [u’with-profile’, u’dev’, u’do’, u’start-dev’], u’Config’: {u’AttachStderr’: False, u’AttachStdin’: False, u’AttachStdout’: False, u’Cmd’: None, u’Domainname’: u’‘, u’Entrypoint’: [u’lein’, u’with-profile’, u’dev’, … compose.parallel.feed_queue: Pending: set([<Service: ngcracealong-rsync>]) compose.parallel.feed_queue: Starting producer thread for <Service: ngcracealong-rsync> compose.service.start_container_if_stopped: Starting docker-clojurescript compose.cli.verbose_proxy.proxy_callable: docker attach <- (u’dfbae0eb3e7589786a8d9bf71bbe8a01cc22088cc88a4d0fa2b06fbccb29742d’, stream=True, stderr=True, stdout=True) compose.cli.verbose_proxy.proxy_callable: docker attach -> <generator object _multiplexed_response_stream_helper at 0x1015b8730> compose.cli.verbose_proxy.proxy_callable: docker start <- (u’dfbae0eb3e7589786a8d9bf71bbe8a01cc22088cc88a4d0fa2b06fbccb29742d’) compose.parallel.feed_queue: Pending: set([]) compose.cli.verbose_proxy.proxy_callable: docker start -> None compose.parallel.parallel_execute_iter: Finished processing: <Service: ngcracealong-rsync> compose.parallel.feed_queue: Pending: set([]) Attaching to docker-clojurescript compose.cli.verbose_proxy.proxy_callable: docker events <- (decode=True, filters={u’label’: [u’com.docker.compose.project=ngcracealongdocker’, u’com.docker.compose.oneoff=False’]}) compose.cli.verbose_proxy.proxy_callable: docker events -> <generator object _stream_helper at 0x1015b8780> docker-clojurescript | ‘start-dev’ is not a task. See ‘lein help’. docker-clojurescript | Error encountered performing task ‘do’ with profile(s): ‘dev’ docker-clojurescript | Task not found compose.cli.verbose_proxy.proxy_callable: docker wait <- (u’dfbae0eb3e7589786a8d9bf71bbe8a01cc22088cc88a4d0fa2b06fbccb29742d’) compose.cli.verbose_proxy.proxy_callable: docker inspect_container <- (u’dfbae0eb3e7589786a8d9bf71bbe8a01cc22088cc88a4d0fa2b06fbccb29742d’) compose.cli.verbose_proxy.proxy_callable: docker inspect_container -> {u’AppArmorProfile’: u’‘, u’Args’: [u’with-profile’, u’dev’, u’do’, u’start-dev’], u’Config’: {u’AttachStderr’: False, u’AttachStdin’: False, u’AttachStdout’: False, u’Cmd’: None, u’Domainname’: u’‘, u’Entrypoint’: [u’lein’, u’with-profile’, u’dev’,

Can someone help me figure ut what is going wrong here?

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 20

Most upvoted comments

tty: true doesn’t work for me

tty: true was key 😃

I would uncomment tty: true, and run COMPOSE_HTTP_TIMEOUT=8000 ocker-compose -f docker-compose.yml -f docker-compose-dev.yml up

@zuernBernhard tty:true hangs

@shin- well I tried your solution and no dice. Must say this has been a frustrating week debugging this docker tooling framework rather than working on my own project …sigh

This issue has been automatically closed because it had not recent activity during the stale period.

in the docker-compose.yml file add the below code in services stdin_open: true

I must admit I am not familiar with how docker-sync works, but I was able to run a long-lived container using the following config:

docker-compose.yml

services:
  ngcracealong-rsync:
    entrypoint: ['bash']
    container_name: 'docker-clojurescript'
    environment:
      - DEBUG=true
    expose:
      - "3000"
      - "9000"
    image: rand/docker-clojurescript
    ports:
      - "3000:3000"
      - "9000:9000"
    working_dir: '/data'
    read_only: false
    privileged: true
    tty: true
version: '2'

docker-compose-dev.yml

services:
  ngcracealong-rsync:
    volumes:
      - ngcracealong-rsync-sync:/data:rw
version: '2'
volumes:
  ngcracealong-rsync-sync:
    external: true

And running docker-compose -f docker-compose.yml -f docker-compose-dev.yml up seems to start properly. Do you see any significant difference with your current setup that could account for the differences?