Reputation: 219
I have an application with Dockerfile + docker-compose.
Dockerfile docker-compose.yml
I have a CI, which creates an image from my dockerfile and send it to the hub.docker
Travis.yaml
When I drop this image on my cloud
server I can not run this image by running the command below:
docker run -d -p 80:80 flask-example
because the container dies.
Besides the downloaded image from hub.docker after compiled by travis, will I need docker-compose on my server? Executing the command:
docker-compose up -d
To run the application? Or is there another way to do it?
Thanks guys.
Upvotes: 1
Views: 719
Reputation: 11337
running docker with -d
flag detached your container, which mean that it runs in background.
Thus, you cannot see the error. Just remove this flag and you will see why it is dying.
From the link to your docker-compose
file, it seems that port 80 is already in used (by frontend
container) so maybe you can try using a different port?
(for example: docker run -d -p 8080:80 flask-example
)
Second, you are right.
docker-compose
is just another way to run your container. You don't have to use both.
Upvotes: 2