Docker: zero to Hero 🐱‍🏍

Dibas Behera
3 min readJul 29, 2022

--

Docker is a tool designed to make it easier to deploy and run applications by using containers.

Docker zero to Hero

Hi Everyone,

Hope everything is well with you & your family.

Let’s discuss on this

1. Introduction of docker ✅

2. How docker will solve your problem ✅

3. #docker Architecture✅

4. #docker Basic Commands and #install Software and Use it. ✅

5. #project: A running project in docker using Dockerfile. 👨 💻

DockerHub: https://hub.docker.com/

Let’s start with how docker come to the market before knowing the technology.

A company needs to develop a Java Application. In order to do so, the developer will set up an environment with a tomcat server installed in it. Once the application is developed, it needs to be tested by the tester. Now the tester will again set up a tomcat environment from scratch to test the application. Once the application testing is done, it will be deployed on the production server. Again the production needs an environment with tomcat installed on it so that it can host the Java application. If you see the same tomcat environment setup is done thrice. There are some issues that I have listed below with this approach:

1) There is a loss of time and effort.

2) There could be a version mismatch in different setups i.e. the developer & tester may have installed tomcat 7, however, the system admin installed tomcat 9 on the production server.

How Docker container can prevent this loss:

In this case, the developer will create a tomcat docker image ( An Image is nothing but a blueprint to deploy multiple containers of the same configurations ) using a base image like Ubuntu, which is already existing in Docker Hub (the Hub has some base images available for free).

Now this image can be used by the developer, the tester, and the system admin to deploy the tomcat environment. This is how this container solves the problem.

What is Docker & why is Docker needed?

Docker is a very popular and powerful open-source containerization platform that is used for building, deploying, and running applications.

What is Container?

A container is a standard unit of software bundle with dependencies so that applications can be deployed fast and reliably between different computing platforms.

Docker can be visualized as a big ship (docker) carrying huge boxes of products (containers).

Benefits

  1. Build app only once
  2. More Sleep and less worry
  3. Portability
  4. Version Control
  5. Isolation
  6. Productivity

Docker Architecture

Basic Commands

$ docker image$ docker pull$ docker container ls$ docker ps -a$ docker run mysql:5.6$ docker run –name myJenkins -p 8080:8080 -p 50000:50000 -v myJenkins:/var/jenkins_home jenkins$ docker volume inspect myJenkins$ docker start <containerId>$ docker stop <containerId>s

Run a Project in Docker

Exercise: Install Ubuntu in docker using DockerFile

1. Create a file name Dockerfile

vi Dockerfile

2. Write syntax

# loading ubuntu in docke
FROM ubuntu:22.04
MAINTAINER dibasbehera <java developer>
RUN apt-get update
CMD [“echo”, “Hello World :”, “from Life Transformation Group”]

3. Build Docker

docker build -t ubuntu:22.04 .

4. Docker runs image

docker run -it ubuntu:22.04

Best Practices

  1. Use only verified docker images
  2. Don’t forget to stop the container

If you want to view the live demo:

Docker Live Demo

Documents: https://tinyurl.com/docker-zero-to-hero

Happy Coding 🙂

Be disciplined and consistent to be a success in your life.

Hope you learn valuable learning and hope you will practice otherwise you will be at the same place tomorrow where are you right now. Whom you are waiting for, no one has time for you, so get up and take action and see the result.

Signing off

🧿 Dibas Behera

--

--

Dibas Behera

I am a Full Stack Java Developer. I share valuable contextual information to have a grow mindset!