[[+content_image]]
P
P
pcdesign2015-08-16 17:43:39
linux
pcdesign, 2015-08-16 17:43:39

How to start (and autostart) services inside a container with Centos7?

I created a new container with Centos7: I
docker run --name centos_container -t -i centos
went into it.
Well, for example, I installed nginx.
And I'm trying to run it:

[[email protected] /]# service nginx start
bash: service: command not found
[[email protected] /]#

How to be?
PS: yum install systemd - gives tons of errors.

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
P
pcdesign, 2015-08-17
@pcdesign

If you can't, but really want to:

docker pull milcom/centos7-systemd
docker run --name my_container_systemd -v /sys/fs/cgroup:/sys/fs/cgroup  -t -i milcom/centos7-systemd

And we start:
Well, that's it.
It turns out a container with centos, which has systemd.

I
index0h, 2015-08-16
@index0h

What about supervisorctl?

M
MintTea, 2015-08-16
@MintTea

How to start (and autostart) services inside a container with Centos7?

Varies depending on the service. Specifically, in your case, you need to turn off daemonization in the nginx config:
And add a command to the Dockerfile that needs to be run when the container starts
: so, you need multiple containers, one per service.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question