![]() |
VOOZH | about |
Docker can be installed in two versions Docker CE(Community Edition) and Docker EE(Enterprise Edition). For small-scale projects or learning, we can use Docker CE.
Before installing Docker on Ubuntu, We have to ensure that the system meets the following requirements:
Tip for Optimized Hosting:
Hostinger offers high-performance cloud servers and Linux-based VPS hosting that are ideal for Docker environments. These hosting plans ensure that your infrastructure meets the kernel version and resource requirements needed for smooth Docker operation. With 24/7 support and scalable performance, you can efficiently deploy Docker containers on a server tailored for growth and reliability.
For seamless Docker deployment,
For Example my system configuration are as follows:
The following are the steps that guides you in installing the Docker on Ubuntu:
Step 1: Update Software Repositories using the following command on the terminal.
sudo apt updateStep 2: Install Docker using the following command
sudo apt install docker.io -yStep 3: Enable and start the docker service by using the following commands.
sudo systemctl enable docker --nowStep 4: Check Docker Version.
docker --versionWe will get a permission denied error as a regular user doesn't have permission to execute docker commands. Know we need to add the the user to the required group.
Step 1: So we need to add an Ubuntu user to the docker group.
#sudo usermod -aG docker $USER
or
#sudo usermod -aG docker ubuntu
getent group dockernewgrp dockerStep 2: Restart the docker daemon which is already running. After restarting only the changes will comes into effect.
sudo service docker restartStep 3: Leave the current SSH terminal and re-login with SSH. then carry out.
docker psYou need to master the docker commands to work more efficiently in the docker following are the some of the commands which are used in docker on daily bases.
After writing the dockerfile know you need to build the dockerfile into the docker image. This is docker image is further used to run the docker containers. Foillowing is the command which is used to build the docker image.
docker build -t <Name of the Dockerfile>
Example:
docker build -t myimg:latest . This command is used to run a container from an image. The docker run command is a combination of the docker create and docker start commands. It creates a new container from the image specified and starts that container. if the docker image is not present, then the docker run pulls that.
$ docker run <image_name>
To give name of container
$ docker run --name <container_name> <image_name>
Example:
docker run myimgIf you are a Docker developer, you might have noticed that working with multiple Docker Images at the same time might be quite overwhelming sometimes. Managing numerous Docker Images all through a single command line is a very hefty task and consumes a lot of time. In this article, we are going to discuss some important Docker Images commands that would make your life easier. Managing Images with the help of these commands will be very easy and will save you a lot of time.
Following are the some of the docker images which are used on the daily bases.
To know more commands which are used to work with docker images refer to the "Working with Docker Images".
Docker Networking allows you to create a Network of Docker Containers managed by a master node called the manager. Containers inside the Docker Network can talk to each other by sharing packets of information. In this article, we will discuss some basic commands that would help you get started with Docker Networking. To know more about Docker networking refer to the Docker Networking.
docker network ls Docker commit command is used to convert the current state of docker container to the docker new image.
First you need to know the ID of the docker container which you want to the docker images after that run the following command.
docker commit <container_id> <new_image_name>docker run -dit --name myc1 ubuntu:latestdocker commit myc1 mynewimgdocker images