Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exited with code 0 #53

Closed
mklueh opened this issue Jul 30, 2017 · 3 comments
Closed

exited with code 0 #53

mklueh opened this issue Jul 30, 2017 · 3 comments

Comments

@mklueh
Copy link

mklueh commented Jul 30, 2017

I´m trying to get my application running, but it terminates immediately and I cannot find a reason for that.

myapplication | => Starting app on port 3000...
myapplication exited with code 0

docker logs just shows "exited with code 0"

How can I see what is going on within the container?

When go in the containers bash and start the application manually, it tells me it cannot reach the database. However, when I launch another docker container I can reach the database without any problems.


version: "3"
services:
  app:
    image: application:v0.0.3
    container_name: myapplication
    build:
        context: "."
    ports:
      - "80:3000"
    volumes:
      - "/application:/var/lib/application"
    environment:
      - MONGO_URL=mongodb://database:27017/meteor
      - DATA_DIRECTORY=/var/lib/application
      - ROOT_URL=http://localhost
    command: chmod a+rwx -R /var/lib/application

  database:
      image: mongo:3.0
      volumes:
        - "/application/db:/data/db:rw"
      command: mongod --smallfiles --quiet --logpath=/dev/null

networks:
  default:
    external:
      name: service-tier
@mklueh mklueh changed the title exited with code 0 - How to find the reason? exited with code 0 Jul 30, 2017
@jshimko
Copy link
Owner

jshimko commented Jul 30, 2017

Looks like you are overwriting the command that starts the app by using:
command: chmod a+rwx -R /var/lib/application

https://docs.docker.com/engine/reference/run/#cmd-default-command-or-options

@jshimko
Copy link
Owner

jshimko commented Jul 30, 2017

To be clear, that means your container is starting up and running chmod a+rwx -R /var/lib/application instead of starting the app with node main.js like it should be. So this isn't a problem with the image. It's your usage of it. It's because you're overriding the command that starts the app to do a permissions change and then the app never gets started. If you want to do some custom steps on the filesystem inside the container, you should either add some steps to your Dockerfile or maybe even fork the project and create your own custom image.

@mklueh
Copy link
Author

mklueh commented Jul 30, 2017

Thanks, it worked;) I put that line in my docker-compose because I had no writing permissions somehow, but that seems to be gone for what reason ever

@jshimko jshimko closed this as completed Jul 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants