Docker Community Forums

Share and learn in the Docker community.

Cannot start docker inside centos7 with systemctl

docker

(Samanduck123) #1

Hi, I am running a few centos7 docker container with:
docker run -it -e "container=docker" --privileged=true -d --security-opt seccomp:unconfined --cap-add=SYS_ADMIN -v /sys/fs/cgroup:/sys/fs/cgroup:ro --name minion-one centos /bin/bash -c "/usr/sbin/init"

and then ran the container with exec. I have installed kubernetes with etcd along with docker but I get the following error when I want to start docker:

[root@master /]# systemctl enable docker
[root@master /]# systemctl start docker
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.

this is the output of journalctl

Oct 02 11:30:34 master systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE

Oct 02 11:30:34 master systemd[1]: Failed to start Docker Application Container Engine.
– Subject: Unit docker.service has failed
– Defined-By: systemd
– Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

– Unit docker.service has failed.

– The result is failed.
Oct 02 11:30:34 master systemd[1]: Unit docker.service entered failed state.
Oct 02 11:30:34 master systemd[1]: docker.service failed.

is there any way to solve this?


(David Maze) #2

I’m not sure what application you’re trying to run, but this is not a best practice. You now have two systemd processes that are trying to control various aspects of your host system (cgroups, sysctl settings, …).

General best practice is to run only one process, generally your application process, in a container; and if you must run an init system, run something light-weight like supervisord and not the behemoth that is systemd. Don’t use --privileged, well, ever, really, unless you have something extremely specialized where the container needs to manage the host.

That error message doesn’t say much more than “it didn’t work”.

Can you run this container outside of an init-system setup?

Are you actually naming your systemd unit file docker.service, and if so, is it conflicting with the system Docker daemon startup?


(Samanduck123) #3

I ran docker in the simplest way, but then I got errors when working with systemctl, operation not permitted. There was a bash script in gitHub that ran the container as posted above and then attached to it using exec. then I could execute systemctl inside the container.

I don’t know what to search, yes the docker file is docker.service as the output prompts but I do not know how to debug it now. can you help me please?

if I do not run docker with the options above i get the following error with systemctl:

[root@4e0cb55fd7ee /]# systemctl start docker
Failed to get D-Bus connection: Operation not permitted

Oct 02 13:04:35 ddf5699ca4b3 systemd[1]: Starting Docker Application Container Engine…
Oct 02 13:04:35 ddf5699ca4b3 docker-current[326]: time=“2016-10-02T13:04:35.840785108Z” level=warning msg="devmapper: Udev sync is not suppo…option"
Oct 02 13:04:35 ddf5699ca4b3 docker-current[326]: time=“2016-10-02T13:04:35.842433860Z” level=error msg="There are no more loopback devices …lable."
Oct 02 13:04:35 ddf5699ca4b3 docker-current[326]: time=“2016-10-02T13:04:35.865874358Z” level=fatal msg="Error starting daemon: error initia…failed"
Oct 02 13:04:35 ddf5699ca4b3 systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Oct 02 13:04:35 ddf5699ca4b3 systemd[1]: Failed to start Docker Application Container Engine.
Oct 02 13:04:35 ddf5699ca4b3 systemd[1]: Unit docker.service entered failed state.
Oct 02 13:04:35 ddf5699ca4b3 systemd[1]: docker.service failed.
Hint: Some lines were ellipsized, use -l to show in full.