Docker container exits within seconds of being created

My GitLab Pipeline runs successfully but the Docker container exits within seconds of being created.

I am running Docker -v 23.0.1 on Ubuntu 22.04 LTS, docker compose version is 2.16.0

I have posted my question on Stack Overflow which contains my Dockerfile.staging, docker-compose.yml, docker-compose.staging.yml, and gitlab-ci.yml file contents.

The main issue is that the application expects Gemfile to be found at /usr/src/app/ but isn’t finding it.

Any recommendations in how to debug this? Can I list the files found within /usr/src/app/ even though the container isn’t running?

Thank you

Do you expect this volume definition to mount local Gemfile to the container or to copy the Gemfile from the container to the host?

      PIDFILE: /tmp/pids/
      - .:/usr/src/app

If you mount an empty folder you will overwite the entire content of the target. If you don’t have Gemfile on the host, it will not be in the container.

1 Like

Thank you rimelek. Thank you for your response and question. I re-read sections within Docker Rails book and the volume section is only for development use. So once I removed it the container would run after it was started within the staging server.