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?
-
1what are you trying to run? Usually, when the command finishes, the container does it fact exit as well.– ThiloSep 25, 2014 at 3:35
-
No the problem here is it doesn't run the command, it just abruptly exits.– Ananth RaviSep 25, 2014 at 5:22
-
1docker run -i -t <image> bash– Ananth RaviSep 25, 2014 at 18:14
5 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)
-
this was a perfect idea! thank you. I'm new to docker and I didn't know I could use logs command to debug containers so easily Jan 1, 2016 at 19:43
-
This helped me address my issue. Once I viewed the logs, I could see that the container didn't have enough memory to run Java.– Bcf AntNov 16, 2016 at 7:35
-
@theelee if
docker logs
doesn't show anything, it means there was no output. Using thedocker ps -a
command, you can see with which status code your container exited (STATUS
column) Jul 29, 2020 at 12:56 -
-
@mLstudent33 That's your error. Check your Docker command (CMD) and your ENTRYPOINT. Nov 27, 2022 at 23:41
Make sure you have the -ti
flags in your docker run
command, otherwise the docker container will exit without letting you run any shells.
In my case the sa password was being rejected as too long. I must have fumbled the setting at some point and the text following the setting had become "part of" the password.
Finding that out was an adventure. My iMac had the defaults - no development tools. I downloaded:
[Kitematic-Mac]
Would a Mac person verify please? I have a feeling there was a third download I needed.
Once I got Kitematic up and running it was easy to see the log and why the start failed from the Settings tab, General, Environment Variables, MSSQL_SA_PASSWORD.
Get this example as a base.
docker pull node
docker run -it node bash
That way -it means interactive and bash means that you'll access to run scripts inside a complete node container with: yarn, npm, and other features...
Naive, but try..
sudo service docker stop and then sudo service docker start
Then docker run the containers you were trying to.