Skip to content

Instantly share code, notes, and snippets.

@pavel-odintsov
Last active December 11, 2022 12:46
Show Gist options
  • Save pavel-odintsov/d215348013cb087e6396d27e0199d6a8 to your computer and use it in GitHub Desktop.
Save pavel-odintsov/d215348013cb087e6396d27e0199d6a8 to your computer and use it in GitHub Desktop.
Ubuntu 22.04 in Docker on Ubuntu 22.04

Create Docker image with systemd enabled:

echo -e "FROM ubuntu:22.04\nENV DEBIAN_FRONTEND noninteractive\nRUN apt-get update; apt-get upgrade; apt-get install -y systemd systemd-sysv; \nCMD ["/lib/systemd/systemd"]" | sudo docker build --tag debian_systemd -

Try running it:

sudo docker run -d -v /home/circleci:/home/circleci -v /sys/fs/cgroup/:/sys/fs/cgroup:ro --privileged --cap-add SYS_ADMIN --name linux_systemd_container_random debian_systemd /lib/systemd/systemd

Then check status:

sudo -E docker ps -a|grep rand

Output:

a8b7894d645f   debian_systemd    "/lib/systemd/systemd"   4 seconds ago   Exited (255) 3 seconds ago             linux_systemd_container_random
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment