What is Docker? Docker is a platform that uses containers to create, manage and use applications. In this guide, we are going to look at how to install Docker CE on Manjaro Linux 20

And what is a container? It can be considered as a package of an application, containing all the necessary dependencies and libraries needed to run the application and can be shipped as one package since they are isolated. This process is called containerization. Docker makes it possible to deploy containers in one or a cluster of Linux machines, where the containers shares resources with the host computer, unlike a virtual machine that get dedicated resources from the host. Containers are therefore preferred to virtual machines since they are light-weight and easy to deploy.

Where is docker useful?

Developers and system administrator mostly use containers to enable them isolate code and applications. It makes it easier for them to make changes to a program. Many containers can run on a single Linux computer reducing the number of systems needed and lowering overhead.

Installing Docker CE on Manjaro Linux

Docker is presented as a Community Edition (CE) and Enterprise Edition (EE). This guide gives a step-by-step guide on how to install ad use docker CE in Manjaro Linux 20.

Update Manjaro packages.

First thing before any installations is to ensure that your system packages are up to date. For Manjaro Linux, run the below command:

$ sudo pacman -Syu

Install Docker CE

After ensuring that your system packages are updated, run the below command to install Docker CE on Manjaro Linux.

$ sudo pacman -S docker

Start and enable docker service

Once installation is complete, start docker service and enable to automatically start after a system reboot.

$ sudo systemctl start docker.service
$ sudo systemctl enable docker.service

Verify docker installation by checking on the installed version.

$ sudo docker version

Run docker with non root user

By default, you will have to run docker with root privileges. In order to run docker with non root user, we need to add our user to docker group.

$ sudo usermod -aG docker $USER

After making the changes, reboot your system for the changes to take effect.

$ sudo reboot

Using Docker CE on Manjaro Linux

The following steps show how to install docker images and run docker containers.

Install Docker images

If you already know the image to use, you can go ahead to pull the image, otherwise you can search through the available images. Docker hub is a registry of docker images that can easily be pulled to run containers. An image is like a container snapshot, which when started creates a container. An image is downloaded from the hub with ‘pull’ command and run with ‘run’ command.

$ docker search <image-name>
$ docker pull <image-name>

For example, let us pull ‘nginx’ image.

$ docker pull nginx

List docker images

In order to check the available docker images on your system, run the below command.

$ docker images

The output should all the images you have pulled or created.

Once you pull an image, you can run it using the below command.

$ docker run -d <image-name>

For example, let us run our nginx image.

$ docker run -d nginx

Note the -d flag makes the container to run in the background. You can list all running containers using the command below. The -a flag shows all the containers including stop ones and the time that were last running.

docker ps
docker ps -a


To stop a container, take the container ID from the command above and use it to stop as below:

#docker container stop <container-ID>

To delete a container, run the command shown below:

$ docker container rm <container-ID>

How to create and use Dockerfiles

Dockerfiles are used to create images to run containers. It contains information that work together to create a docker image. Let us first create a directory for holding our images.

$ sudo mkdir myimages

Change to the directory and create a dockerfile.

$ cd myimages
$ sudo nano dockerfile

Add the following content

FROM ubuntu
RUN apt-get update
CMD [“echo”, “Hello World”]

The used terms are explained below:

  • FROM: Defines the base of the image you are creating. You can start from a parent image (as in the example above) or a base image. When using a parent image, you are using an existing image on which you base a new one. Using a base image means you are starting from scratch (which is exactly how you would define it: FROM scratch).
  • MAINTAINER: Specifies the author of the image.
  • RUN: Instructions to execute a command while building an image in a layer on top of it. In this example, the system searches for repository updates once it starts building the Docker image. You can have more than one RUN instruction in a Dockerfile.
  • CMD – There can be only one CMD instruction inside a Dockerfile. Its purpose is to provide defaults for an executing container. With it, you set a default command. The system will execute it if you run a container without specifying a command.

Build a Docker Image with Dockerfile

We build image from dockerfile using the syntax below:

$ docker build <dockerfile-location>

If you already on the directory where the file is in, run the command as below.

$ docker build .

You should see a sample output as below as the image builds.

To give the new image a name, use tag -t as shown:

$ docker build -t myimage .

Confirm the available images

$ docker images

You should see your new image as part of the available images

Create a container

To create a new container from the new image, use the command below:

$ docker run -test myimage
Hello World

That’s is. You have successfully installed Docker CE on Manjaro Linux and learn how to use Docker as well how to use Dockerfiles. Please check more interesting Linux guides below:

Best Docker Learning Courses:


Please enter your comment!
Please enter your name here