Quantcast
Channel: Why docker container exits immediately - Stack Overflow
Browsing all 21 articles
Browse latest View live

Answer by jkix for Why docker container exits immediately

If you're using docker compose, you can put tty: true in your compose.yml as an argument under a given service:services: ubuntu_test: container_name: dev build: context: . tty: trueSee this answer for...

View Article



Answer by ychz for Why docker container exits immediately

docker logs information is not usually helpful to me. Sometimes app's log is same as docker logs output, sometimes is not.docker inspect not helpful in most case either, unless it is a very obvious...

View Article

Answer by Richi RM for Why docker container exits immediately

$ docker run -di imageIt works.

View Article

Answer by kta for Why docker container exits immediately

Docker container terminates immediately when it did not have any foreground process that helps to connect to user terminal. For example, there is no web server up running in that container.There are...

View Article

Answer by questionto42 for Why docker container exits immediately

If you need to just have a container running without exiting, just rundocker run -dit --name MY_CONTAINER MY_IMAGE:latestand thendocker exec -it MY_CONTAINER /bin/bashand you will be in the bash shell...

View Article


Answer by Vivek for Why docker container exits immediately

You need to run it with -d flag to leave it running as daemon in the background. docker run -d -it ubuntu bash

View Article

Answer by tripleee for Why docker container exits immediately

Coming from duplicates, I don't see any answer here which addresses the very common antipattern of running your main workload as a background job, and then wondering why Docker exits.In simple terms,...

View Article

Answer by Jaydeep Ranipa for Why docker container exits immediately

I added read shell statement at the end. This keeps the main process of the container - startup shell script - running.

View Article


Answer by xavierbaez for Why docker container exits immediately

If you check Dockerfile from containers, for examplefballiano/magento2-apache-phpyou'll see that at the end of his file he adds the following command:while true; do sleep 1; doneNow, what I recommend,...

View Article


Answer by Kert Kukk for Why docker container exits immediately

Add this to the end of Dockerfile:CMD tail -f /dev/nullSample Docker file:FROM ubuntu:16.04# other commandsCMD tail -f /dev/nullReference

View Article

Answer by RJFalconer for Why docker container exits immediately

Why docker container exits immediately?If you want to force the image to hang around (in order to debug something or examine state of the file system) you can override the entry point to change it to a...

View Article

Image may be NSFW.
Clik here to view.

Answer by Sibeesh Venu for Why docker container exits immediately

There are many possible ways to cause a docker to exit immediately. For me, it was the problem with my Dockerfile. There was a bug in that file. I had ENTRYPOINT ["dotnet", "M4Movie_Api.dll] instead of...

View Article

Answer by Adam k for Why docker container exits immediately

Adding exec "$@"at the end of my shell script was my fix!

View Article


Answer by Thiago Ramos for Why docker container exits immediately

whenever I want a container to stay up after finish the script execution I add && tail -f /dev/nullat the end of command. So it should be:/usr/local/start-all.sh && tail -f /dev/null

View Article

Answer by Leon for Why docker container exits immediately

My pracitce is in the Dockerfile start a shell which will not exit immediately CMD [ "sh", "-c", "service ssh start; bash"], then run docker run -dit image_name. This way the (ssh) service and...

View Article


Answer by Brian Olsen for Why docker container exits immediately

A nice approach would be to start up your processes and services running them in the background and use the wait [n ...] command at the end of your script. In bash, the wait command forces the current...

View Article

Answer by dskow for Why docker container exits immediately

Since the image is a linux, one thing to check is to make sure any shell scripts used in the container have unix line endings. If they have a ^M at the end then they are windows line endings. One way...

View Article


Answer by Krishna Gupta for Why docker container exits immediately

I would like to extend or dare I say, improve answer mentioned by camposerWhen you run docker run -dit ubuntuyou are basically running the container in background in interactive mode.When you attach...

View Article

Answer by camposer for Why docker container exits immediately

This did the trick for me:docker run -dit ubuntuAfter it, I checked for the processes running using:docker ps -aFor attaching again the containerdocker attach CONTAINER_NAMETIP: For exiting without...

View Article

Answer by Adrian Mouat for Why docker container exits immediately

A docker container exits when its main process finishes. In this case it will exit when your start-all.sh script ends. I don't know enough about hadoop to tell you how to do it in this case, but you...

View Article
Browsing all 21 articles
Browse latest View live




Latest Images