Sign inSign up

mkubenka/centos-systemd

By mkubenka

•Updated about 10 years ago

CentOS base container with systemd

Image
0

1.4K

mkubenka/centos-systemd repository overview

⁠Example systemd enabled app container

In order to use the systemd enabled base container, you will need to create your Dockerfile similar to the one below.

FROM mkubenka/centos-systemd
RUN yum -y install httpd; yum clean all; systemctl enable httpd.service
EXPOSE 80
CMD ["/usr/sbin/init"]

Build this image:

$ docker build --rm -t local/c7-systemd-httpd

⁠Running a systemd enabled app container

In order to run a container with systemd, you will need to mount the cgroups volumes from the host. Below is an example command that will run the systemd enabled httpd container created earlier.

$ docker run -ti -v /sys/fs/cgroup:/sys/fs/cgroup:ro -p 80:80 local/c7-systemd-httpd

This container is running with systemd in a limited context, with the cgroups filesystem mounted. There have been reports that if you're using an Ubuntu host, you will need to add -v /tmp/$(mktemp -d):/run in addition to the cgroups mount.

On OSX/macOS:

$ docker run -ti --cap-add=SYS_ADMIN --security-opt=seccomp:unconfined --stop-signal=SIGRTMIN+3 -p 80:80 local/c7-systemd-httpd

Tag summary

Content type

Image

Digest

Size

67.3 MB

Last updated

about 10 years ago

docker pull mkubenka/centos-systemd