About this project
Baseimage-docker is a Docker base image built on Ubuntu and adjusted for use inside containers. It is published as `phusion/baseimage` on Docker Hub and GHCR, and is intended as a starting point for your own images.
The project argues that stock Ubuntu is not designed for containers: its Upstart init assumes real or virtualized hardware, and many container corner cases are easy to get wrong. Baseimage-docker bundles the fixes and administration tools it considers necessary.
What it includes:
- A correct init process, `/sbin/my_init`, which reaps orphaned child processes (avoiding zombie accumulation) and forwards SIGTERM to children so they can shut down cleanly instead of being SIGKILLed.
- runit as a replacement for Upstart, used for service supervision and automatic restart of crashed daemons.
- syslog-ng, listening only locally and forwarding messages to `docker logs`, plus logrotate.
- cron, and an SSH server that is disabled by default and allows key authentication only.
- `setuser` for running commands as another user with a correct `$HOME`, and `install_clean` for apt installs that clean up caches.
- Fixes for APT incompatibilities with Docker.
Usage: set `FROM phusion/baseimage:<VERSION>` and `CMD ["/sbin/my_init"]`. Additional daemons are added by creating executable `run` scripts under `/etc/service/<NAME>`; runit starts them and restarts them on exit. Startup scripts can be placed in `/etc/my_init.d` (run in lexicographic order) or `/etc/rc.local`, and must exit with code 0.
Environment variables passed via `docker run --env` or Dockerfile `ENV` are imported by `my_init` from `/etc/container_environment`, then dumped to shell and JSON formats so services and scripts in any language can read the original values. The directory is root-owned and restricted to the `docker_env` group by default because values may be sensitive. Timeouts for terminating children can be tuned with `KILL_PROCESS_TIMEOUT` and `KILL_ALL_PROCESSES_TIMEOUT`.
The README states the image consumes about 8.3 MB of RAM and is lighter than Busybox or Alpine in its own framing. It also explains that running multiple OS processes in one container is compatible with Docker's single-logical-service philosophy, and that the project does not mandate either approach. Ubuntu 26.04 LTS ships Rust Coreutils instead of GNU Coreutils, which the README notes as a consideration.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.