Docker images should have better process handling. Yelp
dumb-init
is a nice basic init written in C.
docker run -d -v /path/to/dumb-init:/dumb-init:ro --entrypoint=/dumb-init <image> <command>
Alternately, docker comes with tini
init builtin.
docker run -d --init <image> <command>
docker-compose supported the docker init option in their 2.2
specification.
Here's an example docker-compose.yml
file using the init option.
version: '2.2'
services:
web:
image: alpine:latest
init: true
Use dumb-init
as the custom init.
version: '2.2'
services:
web:
image: alpine:latest
init: /dumb-init
volumes:
- /path/to/dumb-init:/dumb-init:ro