From 12a2e31f4785e03b75ead5d12315bef5395a721d Mon Sep 17 00:00:00 2001 From: Torben Knerr Date: Wed, 8 May 2019 15:01:08 +0200 Subject: [PATCH] add instructions on how to get systemd based services running in the docker base images --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 752d4f8..52da676 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,22 @@ Vagrant.configure(2) do |config| end ``` +### How to run systemd services in the Docker Base Image? + +You probably noticed that running systemd services usually does not work in docker containers. Still, sometimes it would be useful to have that work (e.g. when testing systemd based services in a docker baseimage). A simple way to do that is to use the `systemctl` binary with gdraheim/docker-systemctl-replacement: + +```ruby +Vagrant.configure(2) do |config| + config.vm.provider "docker" do |docker, override| + docker.image = "tknerr/baseimage-ubuntu:18.04" + # inject docker systemctl replacement so we can use systemd in the docker container + override.vm.provision "shell", privileged: true, inline: <<-EOF + sudo wget -O /bin/systemctl https://raw.githubusercontent.com/gdraheim/docker-systemctl-replacement/master/files/docker/systemctl.py + EOF + end +end +``` + ## Contribute