1. ๐ณ Docker Basics
1.1 What is Docker?
1.2 Dockerfile
2. โ๏ธ How Docker Works
2.1 Client-Server Architecture
2.2 Docker Image
3. ๐ฆ Docker Components
3.1 Docker Container
3.2 Docker Hub
4. ๐ ๏ธ Docker Tools
- 4.1 Docker Commands
5. ๐ Docker Integration
- 5.1 Install Docker On Ubuntu
6. ๐ Examples and Conclusion
6.1 Sample Example: Containerizing Application Using Docker
6.2 Pushing an image to Docker Hub
6.3 Conclusion
โโโ โโ โโ โ โโโฉยฐ๏ฝกโโธ ๐งโฎ1. ๐ณ Docker Basicsโโโ โโ โโ โ โโโฉยฐ๏ฝกโโธ ๐งโฎ
What is Docker?
Docker is an open-source containerization platform by which you can pack your application and all its dependencies into a standardized unit called a container. Containers are light in weight which makes them portable and they are isolated from the underlying infrastructure and from each other container. You can run the docker image as a docker container in any machine where docker is installed without depending on the operating system.
Docker is popular because of the following:
Portability.
Reproducibility.
Efficiency.
Scalability.
โโโ โโ โโ โ โโโฉยฐ๏ฝกโโธ ๐งโฎ **What is 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.
โโโ โโ โโ โ โโโฉยฐ๏ฝกโโธ ๐งโฎโ๏ธ How Docker Worksโโโ โโ โโ โ โโโฉยฐ๏ฝกโโธ ๐งโฎ
โโClient-Server Architectureโโ
Docker makes use of a 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. To know more about working of docker refer to the Architecture of Docker.
โโ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. This image informs how a container should instantiate, determining which software components will run and how. Docker Container is a virtual environment that bundles application code with all the dependencies required to run the application. The application runs quickly and reliably from one computing environment to another.
โโโ โโ โโ โ โโโฉยฐ๏ฝกโโธ ๐งโฎ๐ฆ Docker Componentsโโ โโ โโ โ โโโฉยฐ๏ฝกโโธ ๐งโฎ
โโ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. Containers contain the whole kit required for an application, so the application can be run in an isolated way. For eg.- Suppose there is an image of Ubuntu OS with NGINX SERVER when this image is run with the docker run command, then a container will be created and NGINX SERVER will be running on Ubuntu OS.
โโ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. Generally it makes it easy to find and reuse images. It provides features such as you can push your images as private or public registry where you can store and share Docker images
โโโ โโ โโ โ โโโฉยฐ๏ฝกโโธ ๐งโฎ ๐ ๏ธ Docker Toolsโโโ โโ โโ โ โโโฉยฐ๏ฝกโโธ ๐งโฎ
โฎโฎDocker Commandsโฎโฎ
There are โnโ no.of commands in docker following are some of the commands mostly used.
Docker Run
Docker Pull
Docker PS
Docker Stop
Docker Start
Docker rm
Docker RMI
Docker Images
Docker exec
Docker Login
โโโ โโ โโ โ โโโฉยฐ๏ฝกโโธ ๐งโฎ๐ Docker Integrationโโโ โโ โโ โ โโโฉยฐ๏ฝกโโธ ๐งโฎ
Install Docker On Ubuntu
1. Remove old version of Docker
$ sudo apt-get remove docker docker-engine docker.io containerd runc
2. Installing Docker Engine
$ sudo apt-get update
$ sudo apt-get install docker.io
$ sudo groupadd docker
$ sudo usermod -aG docker ubuntu
Check if docker is successfully installed in your system
$ sudo docker run hello-world
Hands-On: Docker Commands ๐
Task 1: Run a Docker Container
docker run hello-world
Task 2: Inspect Container or Image
docker inspect <container_id_or_image_name>
Task 3: List Port Mappings for a Container
docker port <container_id_or_name>
Task 4: View Resource Usage Statistics
docker stats <container_id_or_name>
Task 5: View Processes Inside a Container
docker top <container_id_or_name> ๐
Task 6: Save an Image to a Tar Archive
docker save -o image_archive.tar <image_name>
Task 7: Load an Image from a Tar Archive
docker load -i image_archive.tar
โโโ โโ โโ โ โโโฉยฐ๏ฝกโโธ ๐งโฎConclusionโโโ โโ โโ โ โโโฉยฐ๏ฝกโโธ ๐งโฎ
Today's exploration took us deep into the heart of Docker, covering essential topics from its fundamentals to hands-on commands. ๐งญ In our journey, we immersed ourselves in Docker's core concepts, bridging theory with hands-on experience. ๐ We sailed through the Docker seas, unraveling the magic of containers, Dockerfiles, and orchestration. โ Navigating through this transformative Docker adventure, we invite you to join us in decoding the enchanting Dockerverse! ๐โจ #DockerDiscovery #HandsOnLearning #DockerJourney ๐ณ