4.36 out of 5
4.36
343 reviews on Udemy

DOCKER | Step by Step for Beginners | with Sample Project

Docker from scratch
Instructor:
Raghav Pal
7,045 students enrolled
English [Auto-generated]
Understand what is DOCKER and How does it work
Understand the use of DOCKER
Install DOCKER on mac, windows and linux

This course is created for complete beginners. 

Understand DOCKER in the most easy way with analogies.

If you want to understand what really docker is and how it works, this course is for you. Very basic step by step videos to guide you from scratch. 

In this session we will start from very basics of DOCKER

  • What is DOCKER

  • Why you should use DOCKER

  • How DOCKER works

  • Benefits of DOCKER

  • How to install DOCKER

  • Basic Commands

  • Docker Images

  • Docker Containers

  • Dockerfile

  • Docker Compose

  • Docker with Jenkins

  • Docker Swarm and much more…

    Let’s Get Started…

INTRODUCTION

1
What is DOCKER

Today we will learn: What is Docker ?

Docker is the world’s leading software container platform

Docker makes the process of application deployment very easy and efficient and resolves a lot of issues related to deploying applications

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

Docker gives you a standard way of packaging your application with all its dependencies in a container

Containers allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and ship it all out as one package.

Understand Docker with analogy of the Shipping industry

How a real world problem was resolved using containers

How DOCKER works

1
Benefits of DOCKER

Today we will learn: Benefits of using Docker

Build app only once

No worries that the application will not perform the same way it did on testing env

Portability

Version Control

Isolation

Productivity

Docker simplifies
DevOps

2
How DOCKER works

Today we will learn: How Docker works ?

1. Understand a general workflow of docker

2. Difference between virtualization and containerization

3. Understand docker client server architecture

4. Understand:
Docker file
Docker images
Docker Containers
Docker Hub / Registry
Docker client
Docker server / daemon
Docker engine

Play with DOCKER

1
Play with Docker without installing on your system

How to install DOCKER

1
How to install DOCKER on LINUX

Today we will learn : How to install Docker on Linux ?

Agenda:
Prerequisites
Connect to Linux
Install Docker
Start Docker
Stop Docker
Uninstall Docker

Prerequisite
OS should be 64 bit
Linux kernel ver 3.10 or greater

command to check : uname -r

STEP 1 - Connect to Linux system

STEP 2 - Install DOCKER
sudo yum -y update
sudo yum install -y docker

docker
docker --version

STEP 3 - start DOCKER
sudo service docker start
sudo usermod -a -G docker "user"

docker info

docker run hello-world : to run hello-world image

docker images : to get list of images present locally

docker ps : to get list of running containers

docker ps -a .  : to get list of all containers

STEP 4 - stop DOCKER
sudo service docker stop
uninstall DOCKER
sudo yum remove docker

HELPFUL TIPS
You can visit - https://get.docker.com/
for more installation related help

To install docker from binaries
https://docs.docker.com/engine/installation/binaries/

Installation steps for amazon ec2
http://docs.aws.amazon.com/AmazonECS/latest/developerguide/docker-basics.html

References:

Linux free instance - https://aws.amazon.com/free/

Docker Manuals - https://docs.docker.com/manuals/

https://get.docker.com/

https://docs.docker.com/engine/installation/binaries/

http://docs.aws.amazon.com/AmazonECS/latest/developerguide/docker-basics.html

2
How to install DOCKER on WINDOWS

Today we will learn : How to install Docker on Windows Step by Step

We will see:

Prerequisites

Install Docker

Troubleshooting tips

Validate installation

Uninstall Docker

____________________________________________________________
USEFUL INFORMATION

If you install the Docker Toolbox on a Windows machine, the installer automatically installs Oracle Virtualbox to run the Docker virtual machine.
____________________________________________________________
Prerequisites
OS - 64 bit
Windows 7 or higher

____________________________________________________________

STEP 1 : Install Docker

https://docs.docker.com/toolbox/toolbox_install_windows/

https://docs.docker.com/docker-for-windows/install/
____________________________________________________________

STEP 2 : Troubleshooting (if any issue occurs)

Convenient way to enable/disable Hyper-V
https://superuser.com/questions/540055/convenient-way-to-enable-disable-hyper-v-in-windows-8

Installing Docker Toolbox on Windows with Hyper-V Installed
https://jayvilalta.com/blog/2016/04/28/installing-docker-toolbox-on-windows-with-hyper-v-installed/

____________________________________________________________

STEP 3 : validate INSTALLATION
run some docker commands

docker
docker --version
docker run "image name"
____________________________________________________________

STEP 4 : uninstall DOCKER

____________________________________________________________

USEFUL LINKS

https://stackoverflow.com/questions/36885985/cannot-start-docker-after-installation-on-windows

https://docs.docker.com/toolbox/faqs/troubleshoot/

____________________________________________________________

References :
Image of docker architecture
References - https://www.wedidknow.xyz/2017/03/docker-ecosystem-how-to-manage-your.html

____________________________________________________________

3
How to install DOCKER on MAC OS

Today we will learn : How to install Docker on MacOS

Prerequisites
Docker - Mac OS Yosemite 10.10.3 or above
Docker Toolbox -  mac OS 10.8 “Mountain Lion” or newer

STEP 1 
Install DOCKER

STEP 2
validate INSTALLATION
run some docker commands

STEP 3
uninstall DOCKER

References:
https://www.docker.com/
https://www.docker.com/docker-mac
https://store.docker.com/editions/community/docker-ce-desktop-mac
https://www.docker.com/products/docker-toolbox
https://docs.docker.com/toolbox/overview/
https://docs.docker.com/toolbox/toolbox_install_mac/

DOCKER COMMANDS

1
Docker Basic Commands and FAQ

Docker Basic Commands | Step by Step for Beginners

Basic

> docker version

> docker -v

> docker infod

> docker --help

> docker login

————————————

Images

> docker images

> docker pull

> docker rmi

————————————

Containers

> docker ps

> docker run

> docker start

> docker stop

————————————

System

> docker stats

> docker system df

> docker system prune

References - 

https://hub.docker.com/

https://docs.docker.com/engine/reference/commandline/ps/

DOCKER IMAGES

1
Docker Images | Step by Step for Beginners

Today we will learn :

  1. What are images
  2. How to pull image
  3. How to run a container using an image
  4. Basic Commands

TIPS & TRICKS

What are Images

Docker Images are templates used to create Docker containers

Container is a running instance of image

Where are Images Stored

Registries (e.g. docker hub)

Can be stored locally or remote

: docker images --help

: docker pull image

: docker images

: docker images -q

: docker images -f “dangling=false”

: docker images -f “dangling=false” -q

: docker run image

: docker rmi image

: docker rmi -f image

: docker inspect

: docker history imageName

References:

https://hub.docker.com/_/ubuntu/

https://docs.docker.com/engine/reference/commandline/images/

Docker can build images automatically by reading the instructions from a Dockerfile.

Containers are running instances of Docker Images

A single image can be used to create multiple containers

_____________________________________________________

DOCKER CONTAINERS

1
What are Docker Containers | How to create Docker Containers

Docker Containers

B E G I N N E R S

Today we will learn :

  1. What are Containers
  2. How to create Containers
  3. How to start / stop Containers
  4. Basic Commands

TIPS & TRICKS

What are Containers:

Containers are running instances of Docker Images

COMMANDS

: docker ps

: docker run ImageName

: docker start ContainerName/ID

: docker stop ContainerName/ID

: docker pause ContainerName/ID

: docker unpause  ContainerName/ID

: docker top ContainerName/ID

: docker stats ContainerName/ID

: docker attach ContainerName/ID

: docker kill ContainerName/ID

: docker rm ContainerName/ID

: docker history ImageName/ID

References:

https://www.google.co.in/search?rlz=1C5CHFA_enIN734IN734&biw=1280&bih=703&tbm=isch&q=docker+containers&chips=q:docker+containers,g_5:architecture+docker&sa=X&ved=0ahUKEwiRhIOgkYXcAhVEqo8KHYjABTcQ4lYIMCgA#imgrc=AfGnqueGte31MM:

https://docs.docker.com/engine/reference/commandline/container/#child-commands

_____________________________________________________

Notes

What are Containers:

Containers are running instances of Docker Images

A container image is a lightweight, stand-alone, executable package of a piece of software that includes everything needed to run it: code, runtime, system tools, system libraries, settings.

Features of Containers:

Are lightweight

Less resources are used

Booting of containers is very fast

Can start, stop, kill, remove containers easily and quickly

Operating System resources can be shared within Docker

Containers run on the same machine sharing the same Operating system Kernel, this makes it faster

You can use command

docker container create

to create container in stopped state

JENKINS CI on DOCKER

1
How to run Jenkins on Docker container

Jenkins on Docker
Step by Step for Beginners

Today we will learn :

  1. How to start Jenkins on Docker Container
  2. Start and Stop Jenkins Container
  3. How to set Jenkins home on Docker Volume and Host Machine

> docker pull jenkins

> docker run -p 8080:8080 -p 50000:50000 jenkins

> docker run --name MyJenkins -p 8080:8080 -p 50000:50000 -v /Users/raghav/Desktop/Jenkins_Home:/var/jenkins_home jenkins

> docker run --name MyJenkins2 -p 9090:8080 -p 50000:50000 -v /Users/raghav/Desktop/Jenkins_Home:/var/jenkins_home jenkins

> docker volume create myjenkins

> docker volume ls

> docker volume inspect myjenkins

> docker run --name MyJenkins3 -p 9090:8080 -p 50000:50000 -v myjenkins:/var/jenkins_home jenkins

> docker inspect MyJenkins3

References - https://hub.docker.com/_/jenkins/

DOCKERFILE

1
What is Dockerfile | How to create and build Dockerfile

Dockerfile

B E G I N N E R S

Today we will learn :

  1. What is Dockerfile
  2. How to create Dockerfile
  3. How to build image from Dockerfile
  4. Basic Commands

TIPS & TRICKS

Dockerfile : 

A text file with instructions to build image

Automation of Docker Image Creation

FROM

RUN

CMD

Step 1 : Create a file named Dockerfile

Step 2 : Add instructions in Dockerfile

Step 3 : Build dockerfile to create image

Step 4 : Run image to create container

COMMANDS

: docker build 

: docker build -t ImageName:Tag directoryOfDocekrfile

: docker run image

References:

https://github.com/wsargent/docker-cheat-sheet#dockerfile

https://docs.docker.com/engine/reference/builder/#environment-replacement

https://www.google.co.in/search?q=dockerfile&rlz=1C5CHFA_enIN734IN734&source=lnms&tbm=isch&sa=X&ved=0ahUKEwicqqOe_oTcAhWLbysKHX_6B5sQ_AUICigB&biw=1280&bih=703#imgrc=zY4gTeVpM446JM:

_____________________________________________________

DOCKER COMPOSE

1
What is Docker Compose | How to create docker compose file | How to use Compose

Docker COMPOSE

Today we will learn :

  1. What | Why - Docker Compose
  2. How to install
  3. How to create docker compose file
  4. How to use docker compose file to create services
  5. Basic Commands

TIPS

Docker compose

: tool for defining & running multi-container docker applications

: use yaml files to configure application services (docker-compose.yml)

: can start all services with a single command : docker compose up

: can stop all services with a single command : docker compose down

: can scale up selected services when required

Step 1 : install docker compose

(already installed on windows and mac with docker)

docker-compose -v

2 Ways

1.  https://github.com/docker/compose/releases

2. Using PIP

pip install -U docker-compose

Step 2 : Create docker compose file at any location on your system

docker-compose.yml

Step 3 : Check the validity of file by command

  docker-compose config

Step 4 : Run docker-compose.yml file by command

docker-compose up -d

Steps 5 : Bring down application by command

docker-compose down

TIPS

How to scale services

—scale

docker-compose up -d --scale database=4

References:

https://hub.docker.com

https://github.com/docker/compose/releases

https://docs.docker.com/compose/compose-file/

https://www.google.co.in/search?q=microservices+example&rlz=1C5CHFA_enIN734IN734&source=lnms&tbm=isch&sa=X&ved=0ahUKEwjE3LPQqYfcAhXGpY8KHQHmB4gQ_AUICigB#imgrc=4466IjbSng_wcM:

____________________________________________________________________

VOLUMES & BIND MOUNT

1
How to create and manage Volumes and Bind Mount

Today we will learn:

  1. What are Volumes
  2. How to create / list / delete volumes
  3. How to attach volume to a container
  4. How to share volume among containers
  5. What are bind mounts

Volumes are the preferred mechanism for persisting data generated by and used by Docker containers

> docker volume  //get information

> docker volume create

> docker volume ls

> docker volume inspect

> docker volume rm

> docker volume prune

Use of Volumes

===========

Decoupling container from storage

Share volume (storage/data) among different containers

Attach volume to container

On deleting container volume does not delete

Commands

docker run --name MyJenkins1 -v myvol1:/var/jenkins_home -p 8080:8080 -p 50000:50000 jenkins

docker run --name MyJenkins2 -v myvol1:/var/jenkins_home -p 9090:8080 -p 60000:50000 jenkins

ocker run --name MyJenkins3 -v /Users/raghav/Desktop/Jenkins_Home:/var/jenkins_home -p 9191:8080 -p 40000:50000 jenkins

References

https://hub.docker.com/_/jenkins/

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

DOCKER SWARM

1
What is Docker Swarm | How to create Docker Swarm

DOCKER LOGS

1
How to view Logs in Docker

Docker : How to view Logs

Today we will learn:

  1. How to view logs in Docker

  2. How to use options in docker logs command

____________________________________________


docker logs ContainerID/Name

docker service logs ServiceID/Name


How to view logs of a container

docker logs ContainerID/ContainerName


Get all the details

docker logs --details 


Follow logs or tail continuously

docker logs --follow 


View last n lines of the log

docker logs --tail 50 


View logs since last particular date or timestamp

docker logs --since 10m 

docker logs --since 2018-08-27 

docker logs --since 2018-08-27T10:00 


View logs with timestamp

docker logs --timestamps 10m 


REFERENCES

https://docs.docker.com/engine/reference/commandline/logs/


2
Docker Logs Practice and QnA

DOCKERIZE JAVA PROJECT

1
How to create Docker Image from Java Maven Project

How to create Docker Image from Java Maven Project

Step by Step for Beginners

Today we will learn:

  1. Add docker maven plugin

  2. Auto generate dockerfile for a java maven project

  3. Create docker images for java maven project

  4. Push the image to docker hub

  5. Run the image

Step 1 : Create java maven project

Step 2 : Add docker maven plugin info in pom.xml


Step 3 : Save and build maven project. Create docker image

https://github.com/spotify/docker-maven-plugin

https://github.com/spotify/docker-maven-plugin/releases

mvn clean

mvn package

mvn docker:build


Step 4 : Run image and validate

Step 5 : Push to docker hub

(Use your docker hub username in place of raghavpal and your imagename in place of imagename)

docker login

docker tag imagename raghavpal/imagename

docker push raghavpal/imagename


REFERENCES

how to install maven on Mac OS

https://www.youtube.com/watch?v=EoXImdzlAls

how to install maven on Windows

https://www.youtube.com/watch?v=K9U-5aa8VwE

2
Dockerize a Java Maven Project

INTERVIEW QUESTIONS

1
Docker Interview Questions - Part 1

SAMPLE PROJECT | Docker, GitHub, Java, Maven, Jenkins

1
Docker Sample Project | Part 1

Docker Sample Project 

—————————————

Java | Maven | GitHub | Jenkins | Docker                             by :  Raghav Pal



.. BUILD | TEST | DEPLOY …


This is what we will do today:

Create a Java Maven Project


Add docker maven plugin to create docker image for the project

            
Create a GitHub account & repository


Push the project to GitHub


Create a Jenkins job to pull from GitHub and build project - BUILD


Create a Jenkins job to create Dockerfile and image - DOCKERIZE


Create a Jenkins job to run the docker image and validate - RUN


Create a Jenkins job to run tests on the docker image - TEST


Create a Jenkins job for pushing image to docker hub - PUSH


Create a Jenkins job to pull and test image - VALIDATE


Chain all the jobs


Create a Jenkins Pipeline (Delivery Pipeline)



REFERENCES


How to install maven on Mac OS

https://www.youtube.com/watch?v=EoXImdzlAls


How to install maven on Windows

https://www.youtube.com/watch?v=K9U-5aa8VwE


How to add eclipse project to GitHub 

https://www.youtube.com/watch?v=LPT7v69guVY


How to install git on window

https://www.youtube.com/watch?v=sBTAkHOxvOk


How to install git on Mac

https://www.youtube.com/watch?v=0Icla6TVNNo


    git config --global user.name "Your Name"

    git config --global user.email you@example.com



BUILD

Job 1 : Pull GitHub project and build


DOCKERIZE

Job 2 : Create dockerfile


RUN

Job 3 : Run docker image to validate


TEST

Job 4 : Run tests


PUSH

Job 5 : Push image to repo (docker hub)


VALIDATE

Job 6 : Pull and run image to validate


2
Docker Sample Project | Part 2
You can view and review the lecture materials indefinitely, like an on-demand channel.
Definitely! If you have an internet connection, courses on Udemy are available on any device at any time. If you don't have an internet connection, some instructors also let their students download course lectures. That's up to the instructor though, so make sure you get on their good side!
4.4
4.4 out of 5
343 Ratings

Detailed Rating

Stars 5
139
Stars 4
132
Stars 3
52
Stars 2
13
Stars 1
7
d1e5c7ac091f0ea6545ac3f557676a3b
30-Day Money-Back Guarantee

Includes

5 hours on-demand video
Full lifetime access
Access on mobile and TV
Certificate of Completion