You are on page 1of 7

Docker

Problems Introduction to Docker

- Different applications would require different - Docker was introduced in 2013


resources, OS and environment. So, we would - Docker is used to run each component in different
need a lot of space to have different machines to containers with its own libraries and
run them separately dependencies in the same operating system
- With the need of different machines, we need - Docker is used to change or modify any
more money to be invested in component without affecting the other component
- Virtual machine (VM) - Docker containers are like isolated boxes which
a. Is an environment which is created virtually contain all the ideal conditions for the application
within the computer to be executed on any operating system
b. It works on a host computer with an isolated - We would just need to get the right
partition with its own resources such as configurations inside the container which has to
power, memory and more be given to the tester for executing the code and
c. Therefore, various applications can be testing it as he wishes too
executed on different virtual machines that - Docker container
run on a single server a. Containers are software units that are
- Loophole standardized
a. VM have some loopholes. They take a long b. It has code and all the dependencies that
time to boot up makes it easier for the application to run from
b. Since different versions of OS run on the one environment to the other
same machine, this costs memory and c. Docker containers are light – weighted
resources, this makes our system slow components that can be deployed on virtual or
c. On the other hand, we also wanted to ship physical machines as well as on could.
these apps to the public cloud d. Advantages
d. And the cloud is supposed to have hundreds 1) Docker engine shares some of its memory,
of different types of applications running with the container
- While looking for a solution to our problems, our 2) In simpler terms, it shares the
team discovered Docker environment with the container and hence
- We came across these light – weight containers weighs less than the VM file
which could pack applications and move them - Docker could be said as a container management
easily system
- The size of these containers are of MBs - The main objective of Docker is to deploy
(MicroBytes) and the original server could run up containers anywhere so as to ease the process of
to hundreds of containers (which contained developing applications
applications). Therefore, we used these containers - Docker keywords include BUILD, SHIP and
to create VM’s. Once deployed, it could be used RUN
anywhere - As the keywords specify, the developers can
easily build the application that can be shipped
easily into containers which can be deployed
anywhere on any system. Then, the testers can
run the application and execute the code
Installation Process Docker Commands

A. Docker Installation - Basic commands


- Step to installation
1. Download docker
https://docs.docker.com/desktop/install/win
dows-install/
2. Start by double clicking the installer
3. Agreeing to the terms is must and proceed
ahead with the install button
4. To complete the installation process we need
to click Finish

a. Docker is a platform that allows you to


develop, test, and deploy portable
applications, independable containers that run
virtually anywhere
b. Open Docker Quickstart terminal to access
docker terminal
c. Basic commands :
5. Once installation is done, click on the start 1. $docker – it is used to look for the list of
button and type docker app. available commands, run the command
docker with no parameters this will print
Double – click and open the docker hub that the list of available commands
will let you know the status of all the images
and containers that have been created until
today

But, it’s the first time we will be running the


docker app in our system, it will be empty

6. We will try running something on command


prompt to check if docker is running properly
or not

docker run Hey-Hello

Once done, we are all set to use docker in our


system

Note* : general syntax would be :

Docker [OPTIONS]COMMAND [ARG…]

2. $docker images – it is used to list out all


the Docker images that are present on
your Docker Host

B. Docker Toolbox Installation Note* : the output of this command


- Why Docker Toolbox is needed ? represents the name of docker image, its
a. For windows 7 or higher version users, tag, the image Id, the creation time, and
docker provides us with a Docker toolbox the size respectively
b. It is an installer that has everything which is
necessary to configure and launch the 3. $docker rmi – it allows us to remove an
environment for docker image or images from the docker host
c. The operating systems that lack the resources
required for the new docker application,
toolbox comes into picture and helps us to
deploy the development containers
d. Docker toolbox was developed for windows
and MacOS to easily run docker containers
e. Once you are done with downloading the
installer, double click to start with the
following steps: 4. $docker exec – it is used to run a new
f. Docker toolbox contains the following tools command in a running container
1. Docker machine
2. Docker engine
3. Docker compose
4. Kinematic, the docker GUI
5. Docker quickstart terminal app
6. Oracle VM virtualBox
g. Docker toolbox will install the following
applications :
1. Docker client for windows
5. $docker history – it shows the history of a
2. Docker toolbox management tool and ISO
docker image with the image name
3. Oracle virtualBox
mentioned in the command
4. Git MSYS-git UNIX tools
- Step to install Docker toolbox on windows
1. The first screen will have the next button,
click it.

6. $docker info – it helps in displaying


system information. The detailed
information about docker installed on the
system including the kernel version,
number of containers and images, etc.
2. Enter your desired default location and then
click next
3. Lets keep in the default components as it is
and proceed with next

7. $docker pull – it pulls up an image from


the registry. By default, docker pull pulls
a single image from the registry. A
repository can contain multiple images

4. Let’s start with keeping the same additional


tasks and click next
a. Create a desktop shortcut
b. Add docker binaries to PATH
c. Upgrade Boot2Docker VM
- Container commands (checkpoint)
1. $docker ps – this is essential command to list
existing docker containers which are present
in running state. Here, ps stands for “Process
Status”. And it used to describe process status

2. $docker create – this command helps to create


a new container which is writable layer over
5. Finally clik install the specified image. It also prepares it for
running a specific command

3. $docker attach – this command will attach


your terminal’s standard output, input and
error streams to a container which is running
using its ID or name. This allows you to view
its ongoing output or to control its activity, as
though the commands were running directly
in your terminal

4. $docker stop – the docker stop command


stops the container gracefully, that’s the
difference between a kill and stop

5. $docker kill – this command helps to kill one


or more running containers

6. $docker rename – this command helps to


rename a container. When Docker containers
are created, the system automatically assigns
a universally unique identifier (UUID)
number to each container to avoid any naming
conflicts and improve automation without
human involvement

7. $docker update – this command is used to


update configuration of one or more
containers. The docker update command
dynamically updates container configuration.
We can use this command to prevent
containers from consuming too many
resources from their Docker host.
Docker Hub and Images

- Docker Image review


a. Imagine if you need to build a house for
yourself. Let’s catch up the process we need
to do for building a house
b. Firstly, we need to create the blueprint of it
with all the detailed information of each room
with the dimensions, and the way it is to be
structured, and so on
c. Similarly, in Docker, to build up such an
environment, we need to create the blueprint
d. This blueprint comes in the form of Docker
file
e. Docker file as blueprint are the set of
commands in an orderly manner to set up the
environment and that will run by default when
it starts

Docker file –(Build)–> Docker Image –


(Build)–> Docker Container

f. In the same manner, Docker images are


blueprints of the containers, which contain the
required information we need for a container
to assemble
g. A container is created by running an image
h. Docker image is a file, which consists of
multiple layers, which is used to execute the
code in the container
i. As discussed earlier, image is built from a set
of instructions for completing and building an
executable version of the application, that
relies on the host OS kernel
j. Once the Docker user runs an image, it
becomes one or more instances of that
container
k. Docker image includes all the elements that
are needed to run the app as a container.
These include code, config files, environment
variables, libraries and run time
l. The run command creates a container from
the given image. Docker images are also a
reusable asset that can be deployed on any
host
m. To know the list of Docker images in your
system, we use the images command
$docker images

n. We get a similar kind of output as below :


REPOSITOR TAG IMAGE ID CREATED SIZE
Y
ubuntu latest 775349758637 5 minutes 64.2 MB
ago

Note* : it also returns the repository, tag, image Id,


creation time and size of file. This was all about
docker images.

- Docker Hub (checkpoint)

Hands on Docker
Source : https://www.youtube.com/watch?v=26O6Ke03j3Y
Overview

- Container ?
a. Paket yang terstandarisasi untuk menyimpan
software dan dependency
b. Fitur
1. Lightweight
2. Isolated
3. Easily deployable
4. Composable
c. Berguna untuk membundle aplikasi

- Docker ?
a. Merupakan software yang digunakan untuk
membuat container
b. Container akan dijalankan oleh Dockerfile
c. Docker container bukanlah VM karena
berbeda architecture
d. Dockerfile adalah cetakan kue docker image
adalah kuenya (hasil dari cetakan tsb)

- Docker registry ?
GitHubnya docker

You might also like