Running My First Docker Container

In Docker, everything is based on Images. An image is a combination of a file system and parameters. Let’s take an example of the following command in Docker

Here a basic example that write “Hello docker” on your shell.

Let’s understand what’s happens!

We have asked docker to run centos image with name example1 and display “Hello docker” in the output.

So docker has pulled the latest centos image from the Docker registry, create a new container from this image, start the container run echo “Hello docker” inside this container and stop the container.

 Task by trainer :-

  • Pull alpine image on local system.
  • Run alpine image container with name “example2”
  • After running this container “Hello World” message should be print in Output.