Docker is a set of Platforms as a service (PaaS) products that use Operating system-level
virtualization to deliver software in packages called containers. Containers are isolated from one
another and bundle their own software, libraries, and configuration files; they can communicate
with each other through well-defined channels. All containers are run by a single operating system
kernel and therefore use fewer resources than a virtual machine.
Key Components of Docker
The following are the some of the key components of Docker:
• Docker Engine: It is a core part of docker, that handles the creation and management of
containers.
• Docker Image: It is a read-only template that is used for creating containers, containing the
application code and dependencies.
• Docker Hub: It is a cloud based repository that is used for finding and sharing the container
images.
• Dockerfile: It is a script that containing instructions to build a docker image.
• Docker Registry : It is a storage distribution system for docker images, where you can store
the images in both public and private modes.
Dockerfile?
The Dockerfile uses DSL (Domain Specific Language) and contains instructions for generating a
Docker image. Dockerfile will define the processes to quickly produce an image. While creating your
application, you should create a Dockerfile in order since the Docker daemon runs all of the
instructions from top to bottom.
(The Docker daemon, often referred to simply as “Docker,” is a background service that manages
Docker containers on a system.)
• It is a text document that contains necessary commands which on execution help assemble a
Docker Image.
• Docker image is created using a Dockerfile.
client-server architecture. The Docker client talks with the docker daemon which helps in building,
running, and distributing the docker containers. The Docker client runs with the daemon on the
same system or we can connect the Docker client with the Docker daemon remotely. With the help
of REST API over a UNIX socket or a network, the docker client and daemon interact with each other.
Docker Image
It is a file, comprised of multiple layers, used to execute code in a Docker container. They are a set of
instructions used to create docker containers. Docker Image is an executable package of software
that includes everything needed to run an application.
Docker Container
Docker container is a runtime instance of an image. Allows developers to package applications with
all parts needed such as libraries and other dependencies. Docker Containers are runtime instances
of Docker images.
Docker Hub
Docker Hub is a repository service and it is a cloud-based service where people push their Docker
Container Images and also pull the Docker Container Images from the Docker Hub anytime or
anywhere via the internet.
docker ps
docker ps -a
docker ps -all
docker ps -s
docker container ls -s
docker container ls -q
docker ps -a -q
docker ps -aq
docker ps -a -f status=running
docker create --name nginx-container nginx
docker start nginx-container
docker restart <container_id or container_name>
docker start df1c49ee5275
docker stop nginx-container
docker pause nginx-container
docker unpause nginx-container$
Image loading...
docker run -d --name nginx-container nginx
docker run --name nginx-container -d -p 8080:80 nginx
docker rename nginx-container nginx-cont
docker run -it nginx /bin/bash
docker rm -f <container_name or container_id>
docker run --rm <image_name>
docker container prune
docker rm -f $(docker ps -a -q)
docker container rm -f $(docker ps -a -q)
docker container commit centos-container centos-with-new-file
docker exec -it centos-container printenv
docker images
docker images -a
docker images -a
docker build -t centos_buddy .
docker rmi <image_name or image_id>
docker image prune
docker network ls
docker volume create --name volume-name
docker volume ls
docker login
docker push repository_name/imagename:tag
docker pull imagename:tag
docker info
docker version
docker inspect nginx
docker run -it ubuntu /bin/bash
apt install nmap -y
exit
docker ps -a
docker commit c624caff45a8 ubuntu-with-nmap
docker images
docker pull nginx
docker run nginx
docker ps
docker cp index.html my_container:/usr/share/nginx/html/
docker login
docker logout
docker push my_username/my_image
docker pull my_username/my_image
docker image prune
docker container prune
docker volume prune
docker network prune
docker system df
docker stats
mkdir ~/mydockerbuild && cd ~/mydockerbuild
touch example_dockerfile
FROM debian
MAINTAINER Jane Doe jdoe@example.com
CMD ["echo", "Hello, Sunshine!"]
docker build ~/mydockerbuild -f example_dockerfile -t example_image
docker run example_image
Download Docker Desktop
The download will begin automatically. The duration will depend on your internet speed.
After installation, open Docker Desktop.
After clicking “OK,” the installation will start.
After installation completes, it will show a confirmation screen.
Restart your PC to install WSL 2
After restarting, a dialog box will appear. Click the “Stop Docker” button.
Enable Hyper-V
• Restart your PC and enter the BIOS setup:
o Navigate to Settings > Update and Security > Recovery > Advanced Setup > Device
Configuration.
o Ensure the “Enable Turbo Boost on DC” option is marked. Save and exit.