Atlantic.Net Blog

How to Install and Use Docker on Arch Linux

Hitesh Jethva
by Atlantic.Net (511 posts) under Dedicated Server Hosting, Tutorials
0 Comments

Docker is an open-source software platform used to build, test, and deploy applications quickly. It is a lightweight containerization platform that packages up an application and all its dependencies and delivers them into the virtual container. You can then run this container in any Linux operating system. Docker uses resource isolation that allows you to run multiple containers on the same operating system. Docker was originally designed to run on the Linux platform. Now, it also runs on Microsoft Windows and Apple OS X.

This post will show you how to install and use Docker on Arch Linux.

Prerequisites

  • A fresh Arch Linux server on the Atlantic.Net Cloud Platform
  • A root password configured on your server

Step 1 – Create Atlantic.Net Cloud Server

First, log in to your Atlantic.Net Cloud Server. Create a new server, choosing Arch Linux as the operating system with at least 2GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.

Step 2 – Configure Repository

By default, the default repository is outdated in Arch Linux, so you will need to modify the default mirror list. You can do it by editing the mirrorlist configuration file:

nano  /etc/pacman.d/mirrorlist

Remove all lines and add the following lines:

## Score: 0.7, United States
Server = http://mirror.us.leaseweb.net/archlinux/$repo/os/$arch
## Score: 0.8, United States
Server = http://lug.mtu.edu/archlinux/$repo/os/$arch
Server = http://mirror.nl.leaseweb.net/archlinux/$repo/os/$arch
## Score: 0.9, United Kingdom
Server = http://mirror.bytemark.co.uk/archlinux/$repo/os/$arch
## Score: 1.5, United Kingdom
Server = http://mirrors.manchester.m247.com/arch-linux/$repo/os/$arch
Server = http://archlinux.dcc.fc.up.pt/$repo/os/$arch
## Score: 6.6, United States
Server = http://mirror.cs.pitt.edu/archlinux/$repo/os/$arch
## Score: 6.7, United States
Server = http://mirrors.acm.wpi.edu/archlinux/$repo/os/$arch
## Score: 6.8, United States
Server = http://ftp.osuosl.org/pub/archlinux/$repo/os/$arch
## Score: 7.1, India
Server = http://mirror.cse.iitk.ac.in/archlinux/$repo/os/$arch
## Score: 10.1, United States
Server = http://mirrors.xmission.com/archlinux/$repo/os/$arch

Save and close the file, then update all the package indexes with the following command:

pacman -Syu

Step 3 – Install Docker

By default, the Docker package is available in the Arch Linux default repository. You can install it easily using the following command.

pacman -S docker

Once the Docker is installed, enable the Docker service to start at system reboot.

systemctl enable docker

Next, restart your system to apply the system.

reboot

After the successful restart, you can verify the status of Docker using the following command.

systemctl status docker

You will get the following output.

● docker.service - Docker Application Container Engine
     Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; preset: disabled)
     Active: active (running) since Thu 2023-01-05 00:00:42 EST; 56s ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 265 (dockerd)
      Tasks: 15 (limit: 2349)
     Memory: 138.7M
        CPU: 486ms
     CGroup: /system.slice/docker.service
             ├─265 /usr/bin/dockerd -H fd://
             └─356 containerd --config /var/run/docker/containerd/containerd.toml --log-level info

You can check Docker information using the following command.

docker info

You should see the following output.

Client:
 Context:    default
 Debug Mode: false

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 20.10.22
 Storage Driver: overlay2

Step 4 – Verify Docker Installation

Next, download and run a simple hello-world container to test whether the Docker works or not.

docker run hello-world

This will download the hello-world docker image and run it as shown below.

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete 
Digest: sha256:94ebc7edf3401f299cd3376a1669bc0a49aef92d6d2669005f9bc5ef028dc333
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

You can verify the downloaded image using the following command.

docker images

You should see the following output.

REPOSITORY    TAG       IMAGE ID       CREATED         SIZE
hello-world   latest    feb5d9fea6a5   15 months ago   13.3kB

You can also check the status of the hello-world container using the following command.

docker ps -a

You will get the following output.

CONTAINER ID   IMAGE         COMMAND    CREATED          STATUS                      PORTS     NAMES
0afb4631a34b   hello-world   "/hello"   18 seconds ago   Exited (0) 17 seconds ago             epic_kalam

Step 5 – How to Use Docker

With Docker, you can download any image and run it inside the container.

Let’s download the Ubuntu image and run it inside the container.

docker run -dit ubuntu:latest

You will get the following output.

Unable to find image 'ubuntu:latest' locally
latest: Pulling from library/ubuntu
6e3729cf69e0: Pull complete 
Digest: sha256:27cb6e6ccef575a4698b66f5de06c7ecd61589132d5a91d098f7f3f9285415a9
Status: Downloaded newer image for ubuntu:latest
40c92b4107f8d7ff37d41d61a5c9b13b87ace2f8e14a32be8c5c52cc35daa6c9

You can verify the status of the Ubuntu container using the following command.

docker ps

You should see the following output.

CONTAINER ID   IMAGE           COMMAND   CREATED          STATUS          PORTS     NAMES
40c92b4107f8   ubuntu:latest   "bash"    10 seconds ago   Up 10 seconds             tender_wozniak

Next, connect to the Ubuntu container using the following command.

docker exec -it 40c92b4107f8 /bin/bash

You will get into the following shell.

[email protected]:/# 

Now, verify your container operating system version using the following command.

cat /etc/lsb-release

You should see the following output.

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.1 LTS"

Finally, exit from the container using the following command.

[email protected]:/# exit

Conclusion

In this post, we explained how to install Docker on Arch Linux. We also showed you how to download and run a container using Docker. You can now try to deploy Docker on dedicated hosting from Atlantic.Net!

Get A Free To Use Cloud VPS

Free Tier Includes:
G3.2GB Cloud VPS Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


Looking for a Hosting Solution?

We Provide Cloud, Dedicated, & Colocation.

  • Seven Global Data Center Locations.
  • Flexible Private, Public, & Hybrid Hosting.
  • 24x7x365 Security, Support, & Monitoring.
Contact Us Now! Med Tech Award FTC
SOC Audit HIPAA Audit HITECH Audit

Recent Posts

How to Set Up Kubernetes Cluster Using Minikube on Arch Linux
How to Install Jenkins on Arch Linux
Which Compliance Standards Require an IPS?
Install Netdata Monitoring Tool on Arch Linux
How to Install Vue.js on Arch Linux

Get started with 12 months of free cloud VPS hosting

Free Tier includes:
G3.2GB Cloud VPS Server Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


New York, NY

100 Delawanna Ave, Suite 1

Clifton, NJ 07014

United States

San Francisco, CA

2820 Northwestern Pkwy,

Santa Clara, CA 95051

United States

Dallas, TX

2008 Lookout Dr,

Garland, Texas 75044

United States

Ashburn, VA

1807 Michael Faraday Ct,

Reston, VA 20190

United States

Orlando, FL

440 W Kennedy Blvd, Suite 3

Orlando, FL 32810

United States

Toronto, Canada

20 Pullman Ct, Scarborough,

Ontario M1X 1E4

Canada

London, UK

14 Liverpool Road, Slough,

Berkshire SL1 4QZ

United Kingdom

Resources