Docker is a popular platform for developing, shipping, and running applications in containers. This article will guide you through the steps to install Docker on an openSUSE system.
Prerequisites
Before installing Docker, ensure that your system meets the following prerequisites:
- Operating System: openSUSE Leap 15.2 or later, or openSUSE Tumbleweed.
- User Privileges: You need root privileges or sudo access to install software packages.
Step 1: Update Your System
Before installing any new packages, it’s a good practice to update your system’s package database and existing packages. Open a terminal and run:
sudo zypper refresh
sudo zypper update
Step 2: Add the Docker Repository
Docker is not included in the default openSUSE repositories, so you need to add the official Docker repository.
sudo zypper addrepo https://download.docker.com/linux/opensuse/docker-ce.repo
Step 3: Install Docker
With the repository added, you can now install Docker. Execute the following command:
sudo zypper install docker-ce
This command installs Docker Community Edition (CE) along with all necessary dependencies.
Step 4: Start and Enable Docker Service
Once Docker is installed, start the Docker service and enable it to start at boot.
sudo systemctl start docker
sudo systemctl enable docker
Output :
ramansah@dev01:~> sudo systemctl start docker
ramansah@dev01:~> sudo systemctl start docker
ramansah@dev01:~> sudo systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; preset: disabled)
Active: active (running) since Wed 2024-06-19 03:35:48 EDT; 7s ago
TriggeredBy: ● docker.socket
Docs: http://docs.docker.com
Main PID: 35483 (dockerd)
Tasks: 17
CPU: 781ms
CGroup: /system.slice/docker.service
├─35483 /usr/bin/dockerd --add-runtime oci=/usr/sbin/runc
└─35490 containerd --config /var/run/docker/containerd/containerd.toml --log-level warn
Jun 19 03:35:46 dev01.bckinfo systemd[1]: Starting Docker Application Container Engine...
Jun 19 03:35:46 dev01.bckinfo (dockerd)[35483]: docker.service: Referenced but unset environment variable eva>
Jun 19 03:35:46 dev01.bckinfo dockerd[35490]: time="2024-06-19T03:35:46.425384150-04:00" level=warning msg="f>
Jun 19 03:35:46 dev01.bckinfo dockerd[35490]: time="2024-06-19T03:35:46.426938437-04:00" level=warning msg="c>
Jun 19 03:35:48 dev01.bckinfo systemd[1]: Started Docker Application Container Engine.
ramansah@dev01:~> sudo systemctl enable docker
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.
Step 5: Verify Docker Installation
To verify that Docker is installed and running correctly, execute:
sudo docker --version
Output :
ramansah@dev01:~> sudo docker version
Client:
Version: 26.1.0-ce
API version: 1.45
Go version: go1.21.9
Git commit: c8af8ebe4a89
Built: Wed Apr 24 13:43:30 2024
OS/Arch: linux/amd64
Context: default
Server:
Engine:
Version: 26.1.0-ce
API version: 1.45 (minimum version 1.24)
Go version: go1.21.9
Git commit: c8af8ebe4a89
Built: Wed Apr 24 13:43:30 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.7.17
GitCommit: 3a4de459a68952ffb703bbe7f2290861a75b6b67
runc:
Version: 1.2.0-rc.1
GitCommit: v1.2.0-rc.1-0-g275e6d85f78a
docker-init:
Version: 0.2.0_catatonit
GitCommit:
You should see the Docker version information. Additionally, you can run a test container:
sudo docker run hello-world
This command downloads a test image, runs it in a container, prints a confirmation message, and exits. The output will be as shown below :
ramansah@dev01:~> docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
c1ec31eb5944: Pull complete
Digest: sha256:d1b0b5888fbb59111dbf2b3ed698489c41046cb9d6d61743e37ef8d9f3dda06f
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.

Step 6: Manage Docker as a Non-Root User (Optional)
By default, Docker requires root privileges. If you prefer to run Docker commands as a non-root user, add your user to the docker
group:
sudo usermod -aG docker $USER
After running this command, log out and log back in to apply the changes.
ramansah@dev01:~> sudo usermod -aG docker $USER
ramansah@dev01:~> newgrp docker
ramansah@dev01:~> id
uid=1000(ramansah) gid=460(docker) groups=460(docker),1000(ramansah)
ramansah@dev01:~>
Troubleshooting Tips
- Docker Service Fails to Start: Ensure that your system is up-to-date and all dependencies are met. Check the status of the Docker service with
sudo systemctl status docker
for more details. - Permission Denied Errors: If you encounter permission errors, make sure you have added your user to the
docker
group and logged out and back in. - Connectivity Issues: Ensure your system has a stable internet connection to download Docker images and updates.
Conclusion
Installing Docker on openSUSE is straightforward once you add the Docker repository and use zypper
to handle the installation. With Docker up and running, you can start exploring containerized applications and enjoy the benefits of a lightweight, portable, and efficient development environment.