Skip to content

Latest commit

 

History

History
39 lines (28 loc) · 951 Bytes

docker.md

File metadata and controls

39 lines (28 loc) · 951 Bytes

Run docker images with an init process

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 include an init

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