Skip to content

Instantly share code, notes, and snippets.

@json-m
Created February 5, 2016 03:14
Show Gist options
  • Select an option

  • Save json-m/79d06f1d17b60ff8f3d7 to your computer and use it in GitHub Desktop.

Select an option

Save json-m/79d06f1d17b60ff8f3d7 to your computer and use it in GitHub Desktop.
centos:7 working systemd
# modified from some redhat page
# to run: --privileged -ti -v /sys/fs/cgroup:/sys/fs/cgroup:ro
FROM centos:7
MAINTAINER "jason" <me@jason.lv>
ENV container docker
RUN yum -y update; \
yum clean all; \
yum -y install systemd; \
yum clean all; \
yum install openssh-server -y; \
yum clean all; \
systemctl enable sshd.server; \
(cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /etc/systemd/system/*.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*;\
rm -f /lib/systemd/system/anaconda.target.wants/*;
EXPOSE 22
VOLUME [ "/sys/fs/cgroup" ]
CMD [ "/usr/sbin/init" ]
@json-m

json-m commented Feb 5, 2016

Copy link
Copy Markdown
Author

@json-m

json-m commented Nov 7, 2017

Copy link
Copy Markdown
Author

also this is an abomination do not use this if it still even works

leaving this here to publicly shame myself for putting systemd+sshd in a container

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment