cover-img

Docker for Beginner's

Devops series

16 November, 2022

3

3

1

Source from Zeal Vora,KPLABS Course(Premium Instructor at Udemy) Udemy

Zeal is one of my favorite author for docker. Please try to yourself 💖
(Tip: HE is ready to give some discount for students 😜)

-----------------Table of content-----------------

1.

What is docker and why we need ?

2.

Docker Installation and pre-requisite

3.

Image VS. Containers

4.

Basic commands

5.

port binding

6.

Attached and detached mode

7.

Restart policy

8.

Disk usage

1.Container and purpose
Docker is the set of alone process and container tool. Its easy to deploy the microservice with running application using the containers.

•

Weightless

•

Movable

•

Compact
2. Docker Installation and pre-requisite
Docker available in variety of operating systems, this includes:
The installation of Docker is pretty straight forward in each one of them.
3. Image VS. Containers
Microservice application (Recipe of microservice) procedural code is called image
img
Running docker image is called container.
img
4. Basic commands
docker images - List the docker images
docker pull image-name i Pull the image from docker hub docker ps - List the container docker stop container-ID - Stop the container docker start container-ID - Start the container docker rm -f image name - Remove the docker image netstat -ntlp - See the running port docker exec -it container-id /bin/bash - Goto inside the container docker run -dt -p containerport:actualport --name=anyname conatainer id - Port mapping with container docker container stop $(docker container ls -aq) - Stop the all container
docker container rm $(docker container ls -aq) - Remove the all container
5. port binding
Goto inside the container
docker exec -it container-id /bin/bash
Port mapping with container
docker run -dt -p 80:81 --name=anyname conatainer id
img
6. Attached and detached mode
docker run -dt
d - detached mode t - terminal tty
When we start a docker container, we need to decide if we want to run in a default foreground mode or the detached mode.
You may want to use this if you want a container to run but do not want to view and follow all its output
7. Restart policy
when docker daemon is stopped that time entire container goes down. we avoid that situation so we using the restart policy

•

no - Do not automatically restart the container

•

on-failure - Restart the container if its exists due to an error

•

unless-stopped - Restart the container unless it is explicitly stopped

•

always - Always restart the container if it stops
8. Disk usage
docker system df
img

docker

devops

development

develevate

begginer

3

3

1

docker

devops

development

develevate

begginer

More Articles

Showwcase is a professional tech network with over 0 users from over 150 countries. We assist tech professionals in showcasing their unique skills through dedicated profiles and connect them with top global companies for career opportunities.

© Copyright 2024. Showcase Creators Inc. All rights reserved.