Docker getting exited just after start

Viewed 5373

So before starting the question here are my understanding for the docker.

  1. Docker has 3 components
  2. Images
  3. Containers
  4. Dockerfile

Now Images are the ones on which the Containers are created and Dockerfile is like a flow what to do. In simple words Images are Classes and Containers are Objects of Images.

Now I don't want to take the approach of the Dockerfile where you specify the steps to perform while creating the container.

I want to install some of the basic entities over Linux like MongoDb,Redis etc and run my server over them.

So I started like this:

  1. I downloaded the Ubuntu image from Docker Hub via docker pull ubuntu which returned me 18261df960118..7a16(big hex key)

  2. Now I have to create a container for this image, to achieve that I did:

    docker create -h abc.com --name abc.com 18261df960118..7a16

which returned me the id of the container.

  1. In order to go into the container I have to first start it and then get attached to it, so for that here are the commands docker start containerId followed by docker attach containerId.

But every time it is saying:

You cannot attach to a stopped container, start it first.

4 Answers
Related