21 Days of Docker-Day 2 — First Docker Container

On Day 1, I gave you the basic introduction to Docker and how to install Docker, it’s time to create your first docker container

Type the below command to run your first docker container

docker container run hello-world
$ docker container run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/engine/userguide/

Let see what happen behind the scene

  • As this is my first container, docker engine tried to find an image named hello-world.
  • But as we just get started, there is no such image stored locally
Unable to find image 'hello-world:latest' locally
  • Docker engine goes to DockerHub(For the time being think DockerHub as a GitHub for Docker containers), looking for this image named hello-world

https://hub.docker.com/

  • It finds the image, pulls it down and then runs it in a container.
  • Hello World only function is to output the text you see in the terminal, after which the container exits

12 Replies to “21 Days of Docker-Day 2 — First Docker Container”

  1. great post, very informative. I ponder why the opposite experts of this sector do not notice this. You should proceed your writing. I’m confident, you have a great readers’ base already!

      1. Hi

        I have added this functionality, If you look at the right side of the blog, you will see something like this “Subscribe to 100 Days of DevOps by Email”. Please let me know if there is any other issue.

        Thanks
        Prashant

  2. This design is incredible! You certainly know how to keep a reader entertained. Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!) Excellent job. I really enjoyed what you had to say, and more than that, how you presented it. Too cool!

  3. I like the helpful info you provide in your articles. I will bookmark your blog and check again here frequently. I’m quite certain I抣l learn plenty of new stuff right here! Good luck for the next!

  4. It’s a shame you don’t have a donate button! I’d most certainly donate to this outstanding blog! I suppose for now i’ll settle for book-marking and adding your RSS feed to my Google account. I look forward to brand new updates and will talk about this blog with my Facebook group. Chat soon!

  5. You can certainly see your expertise in the work you write. The world hopes for more passionate writers like you who aren’t afraid to say how they believe. Always go after your heart.

Leave a Reply

Your email address will not be published.