Docker Tutorial for Beginner – How to run docker

Actually, I cannot call this a tutorial. Its more like a self note for my self to get started with Docker. I am new to Docker and I think Docker has a promising future better than ordinary virtualization technology. I am using Ubuntu 16.04 to install Docker, you can read it here if you want to install Docker on Ubuntu.

Search Image from repository

On this example, I want to pull an image called “hello-world”. Before we pull an image, we can do a search task. The following example shown how to search any images¬†that contains¬†“hello-world”.

root@ip-172-26-4-114:~# docker search hello-world
NAME                                      DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
hello-world                               Hello World! (an example of minimal Docker...   298       [OK]       
tutum/hello-world                         Image to test docker deployments. Has Apac...   34                   [OK]
dockercloud/hello-world                   Hello World!                                    12                   [OK]
marcells/aspnet-hello-world               ASP.NET vNext - Hello World                     4                    [OK]
neoxsys/hello-world                       hello-world container based on Ubuntu 16.0...   1                    [OK]
waleedsamy/hello-world-expressjs-docker   Hello world express sample, return `Hello ...   1                    [OK]
carinamarina/hello-world-app              This is a sample Python web application, r...   1                    [OK]
scottnakada/angular2-docker-hello-world   Angular 2 Hello World Sample Application u...   1                    [OK]
gscrivano/hello-world                     hello world example system container            0                    [OK]
utanna/hello-world                        Nginx hello-world                               0                    [OK]
crccheck/hello-world                      Hello World web server in under 2.5 MB          0                    [OK]
infrastructureascode/hello-world          A tiny "Hello World" web server with a hea...   0                    [OK]
jerzhang/hello-world                      Hello world automated build                     0                    [OK]
navycloud/hello-world                     Navy hello world                                0                    [OK]
helloworld314/hello-world-docker          Hello world docker                              0                    [OK]
mgueury/docker-hello-world                Simple Hello World Example                      0                    [OK]
dharmit/hello-world                       hello world                                     0                    [OK]
hoto/hello-world                          Nodejs hello world application.                 0                    [OK]
wowgroup/hello-world                      Minimal web app for testing purposes            0                    [OK]
jmreeve007/hello-world                    Create automated build for changes to hell...   0                    [OK]
andreamocci/docker-hello-world            Docker hello world.                             0                    [OK]
akshaykawathalkar/hello-world             13 feb hello world                              0                    [OK]
wodge/docker-hello-world                  Hello World test for auto update to Docker...   0                    [OK]
occslab/docker-hello-world                Simple Hello World Example                      0                    [OK]
n8io/hello-world                          A simple hello world node.js app to test d...   0                    [OK]

Pull a Docker Image

The following example showing how to pull a container called hello-world

root@ip-172-26-4-114:~# docker pull hello-world
Using default tag: latest
latest: Pulling from library/hello-world
78445dd45222: Pull complete 
Digest: sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7
Status: Downloaded newer image for hello-world:latest

Now check any available images on our system

root@ip-172-26-4-114:~# docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hello-world         latest              48b5124b2768        3 months ago        1.84 kB

Run a Docker container

Now we have an image called hello-world. Now we can run a container with that image.

root@ip-172-26-4-114:~# docker 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.
 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:

For more examples and ideas, visit:

Show any running container

root@ip-172-26-4-114:~# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

Since there is no running container, the list is empty. We can try another command to show any container that we ran previously

root@ip-172-26-4-114:~# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED              STATUS                          PORTS               NAMES
8bbb37d610fc        hello-world         "/hello"            About a minute ago   Exited (0) About a minute ago                       loving_clarke
7faa44a47a3b        hello-world         "/hello"            2 minutes ago        Exited (0) 2 minutes ago                            tender_mccarthy

Remove/Delete Containers

Use rm command to remove the containers. See the example below. The rm command is followed by the container id.

root@ip-172-26-4-114:~# docker rm 8bbb37d610fc

Enough for now. Will continue to the next post. Lets learn Docker.

Be the first to comment

Leave a Reply

Your email address will not be published.