Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
start docker service fails in container #35317
My host env:
My container file:
This is not a bug; If you want to run systemd inside a container, the container must be started with additional privileges; it also needs access to certain paths on your hosts, which you need to bind-mount into the container.
Generally I'd really discourage using systemd; not only make it your containers less secure (because you have to run with additional privileged), containers are not VM's, and running multiple processes per container is most likely not the "way to go" (YMMV). Instead of using an ssh server, you may want to consider using
First of all, don't define a volume for the cgroups; for systemd to work, it needs access to the cgroups on the host, which has to be specified at runtime, so you can remove this line from your Dockerfile:
VOLUME [ "/sys/fs/cgroup" ]
Using something like this should work to get your container started;
docker run -dt \ --cap-add=SYS_ADMIN \ -e "container=docker" \ -v /sys/fs/cgroup:/sys/fs/cgroup \ centos:centos7.2.1511 /usr/sbin/init
Please keep in mind that the GitHub issue tracker is not intended as a general support forum,
I'm closing this issue because this is not a bug, but feel free to continue the conversation
I use above cmd and still fail:
It looks like you still have the Red Hat fork of Docker installed?
Make sure to uninstall those packages, and install the official ones https://docs.docker.com/engine/installation/linux/docker-ce/centos/