How To Install systemd-docker on Ubuntu 18.04

In this tutorial we learn how to install systemd-docker on Ubuntu 18.04. systemd-docker is wrapper for docker run to handle systemd quirks

Introduction

In this tutorial we learn how to install systemd-docker on Ubuntu 18.04.

What is systemd-docker

systemd-docker is:

systemd-docker is a wrapper for “docker run” so that Docker containers can be sanely run under systemd. The key thing that this wrapper does is move the container process from the cgroups setup by Docker to the service unit’s cgroup.

Using this wrapper containers can be managed through systemctl or the docker CLI and everything should just stay in sync. Additionally one can leverage all the cgroup functionality of systemd and systemd-notify.

There are three methods to install systemd-docker on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install systemd-docker Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install systemd-docker using apt-get by running the following command:

sudo apt-get -y install systemd-docker

Install systemd-docker Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install systemd-docker using apt by running the following command:

sudo apt -y install systemd-docker

Install systemd-docker Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install systemd-docker using aptitude by running the following command:

sudo aptitude -y install systemd-docker

How To Uninstall systemd-docker on Ubuntu 18.04

To uninstall only the systemd-docker package we can use the following command:

sudo apt-get remove systemd-docker

Uninstall systemd-docker And Its Dependencies

To uninstall systemd-docker and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove systemd-docker

Remove systemd-docker Configurations and Data

To remove systemd-docker configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge systemd-docker

Remove systemd-docker configuration, data, and all of its dependencies

We can use the following command to remove systemd-docker configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge systemd-docker

References

Summary

In this tutorial we learn how to install systemd-docker package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.