Docker-alpine: /etc/init.d/xyz start => WARNING: xyz is already starting

Created on 17 Apr 2015  路  2Comments  路  Source: gliderlabs/docker-alpine

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. ???

invalid

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 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.

All 2 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oarmstrong picture oarmstrong  路  4Comments

rmNyro picture rmNyro  路  3Comments

konradjurk picture konradjurk  路  5Comments

ncopa picture ncopa  路  4Comments

frebib picture frebib  路  4Comments