├── 15.04 └── Dockerfile ├── 15.10 └── Dockerfile └── README.md /15.04/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:15.04 2 | # You can change the FROM Instruction to your existing images if you like and build it with same tag 3 | ENV container docker 4 | ENV LC_ALL C 5 | ENV DEBIAN_FRONTEND noninteractive 6 | RUN echo 'APT::Install-Recommends "0"; \n\ 7 | APT::Get::Assume-Yes "true"; \n\ 8 | APT::Get::force-yes "true"; \n\ 9 | APT::Install-Suggests "0";' > /etc/apt/apt.conf.d/01buildconfig 10 | RUN mkdir -p /etc/apt/sources.d/ 11 | RUN echo "deb mirror://mirrors.ubuntu.com/mirrors.txt vivid main restricted universe multiverse \n\ 12 | deb mirror://mirrors.ubuntu.com/mirrors.txt vivid-updates main restricted universe multiverse \n\ 13 | deb mirror://mirrors.ubuntu.com/mirrors.txt vivid-backports main restricted universe multiverse \n\ 14 | deb mirror://mirrors.ubuntu.com/mirrors.txt vivid-security main restricted universe multiverse" > /etc/apt/sources.d/ubuntu-mirrors.list 15 | RUN apt-get update && apt-get install systemd && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* 16 | RUN cd /lib/systemd/system/sysinit.target.wants/; ls | grep -v systemd-tmpfiles-setup | xargs rm -f $1 \ 17 | rm -f /lib/systemd/system/multi-user.target.wants/*;\ 18 | rm -f /etc/systemd/system/*.wants/*;\ 19 | rm -f /lib/systemd/system/local-fs.target.wants/*; \ 20 | rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ 21 | rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ 22 | rm -f /lib/systemd/system/basic.target.wants/*;\ 23 | rm -f /lib/systemd/system/anaconda.target.wants/*; \ 24 | rm -f /lib/systemd/system/plymouth*; \ 25 | rm -f /lib/systemd/system/systemd-update-utmp*; 26 | RUN systemctl set-default multi-user.target 27 | ENV init /lib/systemd/systemd 28 | VOLUME [ "/sys/fs/cgroup" ] 29 | # docker run -it --privileged=true -v /sys/fs/cgroup:/sys/fs/cgroup:ro 444c127c995b /lib/systemd/systemd systemd.unit=emergency.service 30 | ENTRYPOINT ["/lib/systemd/systemd"] -------------------------------------------------------------------------------- /15.10/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:15.10 2 | # You can change the FROM Instruction to your existing images if you like and build it with same tag 3 | ENV container docker 4 | ENV LC_ALL C 5 | ENV DEBIAN_FRONTEND noninteractive 6 | RUN echo 'APT::Install-Recommends "0"; \n\ 7 | APT::Get::Assume-Yes "true"; \n\ 8 | APT::Get::force-yes "true"; \n\ 9 | APT::Install-Suggests "0";' > /etc/apt/apt.conf.d/01buildconfig 10 | RUN mkdir -p /etc/apt/sources.d/ 11 | RUN echo "deb mirror://mirrors.ubuntu.com/mirrors.txt wily main restricted universe multiverse \n\ 12 | deb mirror://mirrors.ubuntu.com/mirrors.txt wily-updates main restricted universe multiverse \n\ 13 | deb mirror://mirrors.ubuntu.com/mirrors.txt wily-backports main restricted universe multiverse \n\ 14 | deb mirror://mirrors.ubuntu.com/mirrors.txt wily-security main restricted universe multiverse" > /etc/apt/sources.d/ubuntu-mirrors.list 15 | RUN apt-get update && apt-get install systemd && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* 16 | RUN cd /lib/systemd/system/sysinit.target.wants/; ls | grep -v systemd-tmpfiles-setup | xargs rm -f $1 \ 17 | rm -f /lib/systemd/system/multi-user.target.wants/*;\ 18 | rm -f /etc/systemd/system/*.wants/*;\ 19 | rm -f /lib/systemd/system/local-fs.target.wants/*; \ 20 | rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ 21 | rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ 22 | rm -f /lib/systemd/system/basic.target.wants/*;\ 23 | rm -f /lib/systemd/system/anaconda.target.wants/*; \ 24 | rm -f /lib/systemd/system/plymouth*; \ 25 | rm -f /lib/systemd/system/systemd-update-utmp*; 26 | RUN systemctl set-default multi-user.target 27 | ENV init /lib/systemd/systemd 28 | VOLUME [ "/sys/fs/cgroup" ] 29 | # docker run -it --privileged=true -v /sys/fs/cgroup:/sys/fs/cgroup:ro 444c127c995b /lib/systemd/systemd systemd.unit=emergency.service 30 | ENTRYPOINT ["/lib/systemd/systemd"] -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Systemd ubuntu for upstream to the docker hub _/ubuntu/1x.xx-systemd 2 | 3 | Based on [docker-systemd](https://github.com/dockerimages/docker-systemd), this is Docker image with Ubuntu running systemd init system inside a container. 4 | 5 | ## Available tags 6 | 7 | `15.04` vivid 8 | 9 | `15.10` wily 10 | 11 | ## Starting a shell with systemd 12 | 13 | ``` 14 | docker run -it --cap-add SYS_ADMIN -v /sys/fs/cgroup:/sys/fs/cgroup:ro dockerimages/systemd:15.04 systemd.unit=emergency.service 15 | ``` 16 | 17 | You need CAP_SYS_ADMIN capability (as in the example above `--caps-add SYS_ADMIN`) or you can just add `--privileged`. 18 | --------------------------------------------------------------------------------