Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker container exits immediately

Tags:

linux

docker

lxc

I'm using docker v1.2 and having some issues starting a container. The container exits after the "docker run". What's the best way to troubleshoot such issues? Also are there major differences in running containers under AUFS and BTRFS?

like image 380
Ananth Ravi Avatar asked Sep 25 '14 03:09

Ananth Ravi


People also ask

Why is docker container exiting immediately?

You're running a shell in a container, but you haven't assigned a terminal: If you're running a container with a shell (like bash ) as the default command, then the container will exit immediately if you haven't attached an interactive terminal.

How do I stop docker compose container from exiting?

If you want to force Compose to stop and recreate all containers, use the --force-recreate flag. If the process encounters an error, the exit code for this command is 1 . If the process is interrupted using SIGINT (ctrl + C) or SIGTERM , the containers are stopped, and the exit code is 0 .

How do I run a docker container continuously?

Dockerfile Command to Keep the Container Running Method 1: You can use the -t (pseudo-tty) docker parameter to keep the container running. Method 2: You can run the container directly passing the tail command via arguments as shown below. Method 3: Another method is to execute a sleep command to infinity.

What is docker exit code1?

Exit Code 1 Indicates that the container stopped due to either an application error or an incorrect reference in Dockerfile to a file that is not present in the container.


Video Answer


1 Answers

You can run docker logs <container_name> to retrieve the logs

(if you don't know what was the container name, you can run docker ps -a to display all the containers)

like image 170
Céline Aussourd Avatar answered Oct 02 '22 18:10

Céline Aussourd