35

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?

Ananth Ravi
  • 647
  • 2
  • 7
  • 13

4 Answers4

73

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)

Céline Aussourd
  • 8,486
  • 4
  • 29
  • 35
  • 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 – Tomáš Tibenský Jan 01 '16 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 Ant Nov 16 '16 at 07:35
  • @theelee if `docker logs` doesn't show anything, it means there was no output. Using the `docker ps -a` command, you can see with which status code your container exited (`STATUS` column) – Céline Aussourd Jul 29 '20 at 12:56
15

Make sure you have the -ti flags in your docker run command, otherwise the docker container will exit without letting you run any shells.

nachocab
  • 10,883
  • 13
  • 74
  • 132
0

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:

bootstrap-4.0.0-alpha.t-dist

[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.

Roy Latham
  • 142
  • 2
  • 5
-5

Naive, but try..

sudo service docker stop and then sudo service docker start

Then docker run the containers you were trying to.

Sheetal Kaul
  • 2,477
  • 2
  • 11
  • 6