Docker Community Forums

Share and learn in the Docker community.

Container not getting started after start command issued


(Vishwamanchala) #1

Hi,
I have just started working with Docker installation and practices through CLI. As a first practice, I have executed the command docker run hello-world and in the console it has displayed Hello from Docker and some other lines.

1. Ran docker info command, on the console it printed Containers: 1 and Images: 2 and some other text
2. Ran docker ps -a, on the console it printed:
CONTAINER ID 42977927dd87
IMAGE hello-world:latest
STATUS Exited
and some conetent
3. Ran docker start 42977927dd87, output:
42977927dd87
4. Ran docker ps command, on the console it just printed the field name as CONTAINER ID but no container id displayed.
5. Again I have ran the command docker ps -a, on the console it printed:
CONTAINER ID 42977927dd87
IMAGE hello-world:latest
STATUS Exited
and some content

Please answer my queries:

  1. Why container is not started after start command? If it started the container ID has to be displayed after docker ps command right?
  2. Why it is showing the status as Exited in docker ps -a command output.
  3. Why Images are showing as 2 in the docker info command output?

Thanks in advance,
Vish


How to create and run n containers form an image
(Jerry Baker) #2

Hi Vish,

I recommend working through the user guide starting from this section: http://docs.docker.com/userguide/#dockerizing-applications-a-hello-world - The docker ps and docker start commands are explained in more detail in the user guide compared to the quick intro.

Thanks,

Jerry


(Ryan Trauntvein) #3

1& 2. The hello-world image just outputs some text and then exits. It does not run as a service. So by the time you start the container, then run docker ps -a you are in fact seeing the container that has exited.

  1. What does docker images output?

(Ralph Kincade) #4

use "-i "and " -t "

https://docs.docker.com/reference/run/