Scratching my head on this one. I've installed logrotate and now I'd like to have cron run, but nothing starts via /etc/init.d or services. Hit this problem too with nginx. ???
This is how Docker and most containers work in general. There is no init system. Your process is pid 1. You'd need to use runit, supervisor, or other codependency script to start the 2 processes at once.
Yes, Docker containers typically run a single service, and don't start an "init" process for managing services via /etc/init.d. To start nginx, you would just run the nginx command instead of its init.d script.
It's also possible to run the cron command directly this way (or a wrapper script that starts both nginx and cron), though for logging there are some other patterns that can work better with Docker. Gliderlabs would of course endorse logspout for pushing your logs to an external service instead of storing them on-disk inside the container. There are also patterns for storing your logs in a separate volume, and then running a separate logrotate container to handle rotating logs across all the Docker containers.
Most helpful comment
Yes, Docker containers typically run a single service, and don't start an "init" process for managing services via /etc/init.d. To start nginx, you would just run the
nginxcommand instead of its init.d script.It's also possible to run the
croncommand directly this way (or a wrapper script that starts both nginx and cron), though for logging there are some other patterns that can work better with Docker. Gliderlabs would of course endorse logspout for pushing your logs to an external service instead of storing them on-disk inside the container. There are also patterns for storing your logs in a separate volume, and then running a separate logrotate container to handle rotating logs across all the Docker containers.