Docker is a container platform that aids in developing, shipping, and running applications leveraging container technology. It is available in enterprise and community editions.
A Docker container is a packaging format that packages the entire code and essential dependencies of an application in a standard format. This allows an application to run across different computing environments. A Docker container is a widely used, light in weight, standalone, executable container that holds everything required to run an application, comprising libraries, system tools, code, and runtime. It helps developers in building, testing, and deploying containerized applications quickly and with ease.
Today, we will explore how to install Docker on Manjaro Linux 21 via the command line. We will run basic Linux commands to install the software and configure it on our system. Then, we will see how we can search for an image, install it on our system and run it using simple Linux commands. In the end, we will look at some of the commands used to monitor Docker’s statistics such as CPU, RAM, and Network usage.
Without any further ado, let’s get started!
Installing Docker on Manjaro Linux 21
Following are the steps you will follow to install Docker on Manjaro Linux 21:
Step 1: Update system
It is recommended to update the system packages and other utilities before any fresh installation of an application. So let’s get started by updating the system using the command mentioned below:
sudo pacman -Syu
Step 2: Install Docker
Now that the system is updated, we can install Docker on it by executing this command:
sudo pacman -S docker
You will be asked to provide the user’s password. Once the password is accepted, you will be asked if you want to proceed with the Docker installation. To continue installing it, enter Y.
The Docker platform will be installed on your system in less than 5 minutes.
Step 3: Enable and Start Docker service
Now that we have successfully installed Docker on our system, let’s start and enable the Docker service to make it functional. Issue the following command to start Docker:
sudo systemctl start docker.service
Now, issue this command to enable Docker:
sudo systemctl enable docker.service
Step 4: Verify Installation
To verify that Docker has been successfully installed on your system, run the following command:
sudo docker version
You will see the following output telling you which Docker version you have installed on your Manjaro machine:
Useful Docker Commands
Now that Docker is installed on our Manjaro machine, let’s explore some useful Linux commands we can run to interact with Docker.
Check Docker Information
If you want to get information on Docker running on your system, use the following command:
sudo docker info
The command will return info like how many containers are running and other Docker configurations as shown below:
Interact with Docker without Root
Every time you want to interact with Docker, you are supposed to login as root or use sudo with the command to get root permissions. If you want to run Docker with the current user and without logging in as root, you need to add your account to the docker group using this command:
sudo usermod -aG docker $USER
Next, you will be required to reboot the system to update the new changes.
After this, you will be able to interact with Docker without logging in as root. Open your command line, and run any Docker command without sudo to verify the new changes.
Search for Docker Image
You are now ready to look for Docker images and install them. To search for an image to install, run the following command:
docker search [name]
To get info on Nginx image, issue this command:
docker search nginx
Similarly, you can find any other Docker image.
Install a Docker image
Once you have decided which image to install, execute the given command to install it on your system. In this tutorial, we will see how to install Hello-World image. Execute this command to install the hello-world package which will be used to download and run images.
docker pull hello-world
The output tells us that Docker was able to find the image we specified. The image is successfully downloaded.
Let’s now run the image we installed and see if it is working or not. Use this command to run hello-world image:
docker run hello-world
This is the output we received after executing the run command:
There are plenty of Linux commands that can be used to monitor Docker. Using these commands, we can keep an eye on the containers that are running and the images that are installed on our system. We can also keep a check on the health of Docker by monitoring its statistics such as CPU and RAM usage. Other than that, Network usage can be monitored too.
To check which Docker Containers are currently active, issue the command mentioned below. This way you can see how many containers are running and see their status.
docker container ls
If you want to see which images are installed on your system, issue the following command:
To monitor Docker statistics, you can use the command given below. This will provide you Docker’s CPU, RAM, and Network usage.
To see Docker’s Network configuration, enter this command:
docker network ls
In today’s guide, we saw in detail how to install Docker on Manjaro Linux 21 using easy-to-follow Linux commands. We first updated our system and then explored a command to install Docker. Then we saw how to start and enable the Docker service after successful installation. Next, we learned how to look for an image to download, install on our system and then run it using one-line commands. In the end, we got familiar with different commands that can provide us with information on Docker. We also saw how we can monitor Docker statistics such as CPU, RAM, and Network usage.
We hope you liked the tutorial.