Docker Community Forums

Share and learn in the Docker community.

Docker container not running

I have the following docker-compose file:

version: '3'
    container_name: ubuntu
    image: ubuntu:latest
    restart: always
      - /home/devops/ubuntu/data:/var/lib/ubuntu
      - /home/devops/ubuntu/config:/etc/ubuntu/

    driver: bridge
      driver: default
        - subnet:

I then execute the command docker-compose up -d

However, then when I try to use the docker shell docker exec -it ubuntu /bin/bash I get this error message:

unable to upgrade to tcp, received 409

I think the problem has to do with my docker-compose file. I am new to Docker and have no idea what I am doing wrong. Thanks in advance to all of those who reply.

EDIT: Now I am getting this error instead:

Error response from daemon: Container e8b1ce3a8de48d14c6216d47c07e569fa157f7d1c3214e972f18f10b3132eafc is restarting, wait until the container is running

There is nothing running in your service, that’s why it exits immediately.
Some more things:

  • If this is for development, use version 2.4 (or the most recent version 2 at the time your read this post)
  • If you are new to Docker, don’t touch the network configuration
  • Don’t add a restart policy

Back to the first point. I don’t know what you need this service for, but if it just want an Ubuntu container to play around with it you can add a dummy command that runs in the foreground, for example:

    command: ['tail', '-f', '/dev/null']
1 Like