Closed punowo closed 1 year ago
Every RUN creates a seperate container, so you can not have background process that still exist in the next RUN.
Please check the examples how to do it.
https://github.com/gdraheim/docker-systemctl-images/blob/master/centos8-lamp-stack.dockerfile
Thanks. I'll look into it.
Is there a way I can do this without having CMD /usr/bin/systemctl
as entrypoint ? Similar to how I'm trying to do it ?
systemctl as the entrypoint does basically execute all ExecStart in enabled x.service files. If you want to run the application parts manually then go ahead with your own wrapper. However everything you do in a docker-entrypoint script can also be encoded in the x.service format.
Oh, and dont forget that systemctl on PID-1 works as a zombie reaper and it can return stop services for a clean shutdown which is what most docker-entrypoint scripts are missing.
I understand everything you just said except this little part, If you want to run the application parts manually then go ahead with your own wrapper.
. Could you please expand a little on it ? Are you referring to a .service file ?
The container should have some application running if you want to have it as server. In general the docker-entrypoint does it. Probably you can override that with a docker-compose or statefulset definition but that's all up to you. Instead of defining the start-command outside you can just as well encode them in an ExecStart in some x.service.
Hello. I'm trying to build an image that I can use as a development environment. I'm on WSL. The idea would be to just docker compose up -d, have the source code in WSL and then build and run the software. Currently calling systemctl start just gets stuck.
The dockerfile is:
docker-compose.yml
docker-entrypoint.sh
Here are some screenshots.