Dockers for Beginners

Isuru Piyarathna
4 min readApr 27, 2020

--

This article is for anyone who wants to learn about Docker containers yet has no clue where to start and what some of those words mean.

What is Docker
Designed to build, ship and run business critical applications in production environment at scale.
you can build and share containers and automate the development pipeline from a single environment. Each of these containers represent the piece of application or a system.
Containers are the building blocks of the containerization world it allow
you to package only the things you need for your application without creating
whole operating systems like virtual machines.
They are faster and more lightweight. Containers give you control over your
environments because you can specify exactly what you want each container to look like by using blueprints called images.

What are docker images

Images are the details used to create containers. They contain everything needed to run an application as a container. This includes:

  • code
  • runtime
  • libraries
  • environment variables
  • configuration files

Images for docker let you specify which services libraries or dependencies you need for a container. A Docker image is built up from a series of layers. Each layer represents an instruction in the image’s Dockerfile.
Then the image can be deployed to any Docker environment and execute as a container.

A Docker container is a runtime instance of an image. From one image you can create multiple containers (all running the same application) on multiple Docker platform.

ex:
you can share images with other people. Once you’ve created an image of a Docker virtual machine, you can send that image to someone else. That person can start a new virtual machine using your image, and their Docker virtual machine will run exactly the same as yours.

This is why Docker is so powerful for creating and deploying applications. Every developer on the team will have the exact same development instance. Each testing instance is exactly the same as the development instance. Your production instance is exactly the same as the testing instance. Because your systems are identical, you don’t need to spend time troubleshooting issues that only exist in one environment.

simple web app without using dockers

Issues we face daily if not using containers

  • Which version of our code?
  • Which dependencies and their versions
  • How to manage each service
  • Networking issues
Day to day problems

Usage of containers

  • Next to user interface we have DEV label so other dev services can see
    and use it. If we want the latest version from the Dev branch it will also automatically link to the web server so the networking is done for us
  • If we containerize all the components we can spin up our entire application with one command and have all of it connected for us automatically
simple web app using containers

How to install docker on windows

  1. Go to https://hub.docker.com/editions/community/docker-ce-desktop-windows and download dockers desktop installer.exe
  2. Run the .exe file after download is finished
  3. Once the installation is done start the desktop docker app by giving the same credentials you used to sign in to the https://www.docker.com/.
  4. open a command prompt and type ‘ docker version’. If you see a output like below latest docker is successfully installed on your machine
docker verification on windows

Congratulations ! Now we are ready to use docker :)

references
https://codingthesmartway.com/docker-beginners-guide-part-1-images-containers/

https://docs.docker.com/storage/storagedriver/

https://stackify.com/docker-image-vs-container-everything-you-need-to-know/

--

--

Isuru Piyarathna

An enthusiastic Full Stack Software Quality Engineering professional | Senior Software Engineer @ WSO2