Hello World with Docker !


To start using Docker, I installed Docker on my machine. At first Docker was only available on Ubuntu. But now Docker engine is supported on Cloud, OS X and Windows as well. Docker can be installed on Mac or Windows using boot2docker by downloading tiny core Linux VM.

Installing Docker for Ubuntu

Log into the Ubuntu installation as a user with sudo privileges

Make sure all your list of packages from all repositories and PPA's is up to date.
$ sudo apt-get update
Download and install Docker.
$ sudo apt-get install -y docker.io
Then verify that Docker has been installed correctly.
$ sudo docker version
If you have installed Docker successfully, above command should pop up details about the client and the server.



Then I ran the 'Hello-world' image.


So what happens when we run this command? 


  1. Docker checks for the presence of the hello-world image locally on the host. Since the image does not exist locally, Docker tries to download or pull the latest hello-world image from Docker Hub. Each line which indicates 'Pull complete' ensures that each layer of the image is pulled successfully. These layers may correspond to installing some prerequisites for the application to run.
  2. Then it creates a new container. Once Docker has the image, it uses it to create a container. A container is created in the file system and a read-write layer is added to the image.
  3. Then it creates a network interface that allows Docker container to talk to the local host.An IP address is attached.
  4. After that application is executed. In this scenario, a message 'Hello from Docker' is displayed. If that message pops up, we can ensure that installation of Docker has been completed successfully. 
The above command has three parts.
            docker : This tells the operating system that you are using the Docker program
            run : This is a sub command that creates and runs a docker container
            hello-world : This tells Docker which image to load into the container

Working with images

The key to start working with any docker container is using images. There are many freely available images shared across docker image index and the command line interface allows simple access to query the image repository and to download new ones.

Docker help : If you are struggled to find out what commands to use with Docker, type docker help or docker and it will provide all the basic Docker commands as follows.

List images : If you want to list the images that are locally available in your host, use the command sudo docker images and the details of the available images will be shown. 




Search images : If you want to search for a specific image, use the command below. For eg: If you enter the command, docker search ubuntu, it will display a very long list of available images matching the query 'ubuntu'.
                                       sudo docker search <image-name> 

Download images : If you are to build a container, you need to have an image at the host machine. If the image is not available in the host, Docker has to download or pull the image from the Docker Hub. 
                                       sudo docker pull <image-name> 

Commit images : Committing makes sure that everything continues from where they left next time you use one.
                                       sudo docker commit <container-ID> <image-name>


Push images : Once we have created our own container, we can sign up at Docker Hub and then we can push our images to Docker Hub so that we can share them with rest of the world.
                                       sudo docker push <user-name / image-name> 



Working with containers

Create a new container : To create a new container, we need to use a base image and specify a command to run. 
                                      sudo docker run <image-name> <command-to-run> 

Run a container : We can get a stopped container to run using this command.
                  sudo docker run <container-id> 

Stop a container : Stop a container's process from running.
                                       sudo docker stop <container-id>


Delete a container : Delete an existing container. 
                                      sudo docker rm <container-id>


List the running containers.
                                      sudo docker ps


Docker Pros

  1. Extreme application portability
  2. Very easy to create and work with derivative.
  3. Fast boot on containers.

Docker Cons

  1. Host-centric solution
  2. No higher level provisioning
  3. No usage tracking or reporting

    12 comments :

    1. Thank you for sharing wonderful information with us to get some idea about that content.
      Microservices Online Training
      Microservices Training in Hyderabad

      ReplyDelete
    2. Hey, What's up, I'm Shivani. I'm an application developer living in Noida, INDIA. I am a fan of technology. I'm also interested in programming and web development. You can download my app with a click on the link. Talk to astrologer

      ReplyDelete
    3. AndroidiOSZone is a leading Mobile app development company in Delhi. where our dedicated team members provide world-class technology solutions to game the competitive market. Share your app idea and Contact Us At 91-9899130284

      ReplyDelete
    4. Hey, What's up, I'm Shivani. I'm an application developer living in Noida, INDIA. I am a fan of technology. I'm also interested in programming and web development. You can download my app with a click on the link. Best astrology app
      Astro guru online
      Best astrologer
      Talk to astrologer
      Onlne astrologer
      Online pandit
      Online astrologer in delhi NCR

      ReplyDelete
    5. Congratulation for the great post. I ended up on your site looking for article on Horse Breeds. I noticed that you certainly do have excellent and creative ideas on the topic. Great read.

      ReplyDelete
    6. Thanks for sharing this informative content , Great work
      Leanpitch provides online training in Enterprise agile coaching during this lockdown period everyone can use it wisely.
      Enterprise agile coaching

      ReplyDelete
    7. Thanks for sharing this informative content , Great work
      Read this blog to know about : Definition of done

      ReplyDelete