tech

21/04/01 (Ubuntu) image with systemd enabled

tech-lover 2021. 4. 1. 16:49
  1. Run the container as a daemon

    $ docker run -d --name systemd-ubuntu --tmpfs /tmp --tmpfs /run --tmpfs /run/lock -v /sys/fs/cgroup:/sys/fs/cgroup:ro         jrei/systemd-ubuntu

    or if it doesn't work

    $ docker run -d --name systemd-ubuntu --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro jrei/systemd-ubuntu
    • Docker loading kernel modules
      $ docker run -d --name systemd-ubuntu --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro --cap-add=ALL -v /dev:/dev -v /lib/modules:/lib/modules jrei/systemd-ubuntu 
  1. Enter to the container

    $ docker exec -it systemd-ubuntu sh
  2. Remove the container

    $ docker rm -f systemd-ubuntu