explaingit

phusion/baseimage-docker

9,099ShellAudience · ops devopsComplexity · 3/5Setup · easy

TLDR

A minimal Ubuntu 24.04 Docker base image that fixes process management, logging, and service supervision issues that occur when running Ubuntu inside containers, so you can focus on your application.

Mindmap

mindmap
  root((baseimage-docker))
    What it does
      Fixed Ubuntu for Docker
      Process management
      Multi service support
    Components
      my init startup
      runit supervisor
      syslog and cron
    Use Cases
      Multi service containers
      Stable Ubuntu base
      SSH debug access
    Setup
      FROM in Dockerfile
      8.3 MB runtime RAM
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Use as the FROM base in your Dockerfile to get correct process management and syslog without any extra configuration.

USE CASE 2

Run multiple background services inside one container with automatic restart on crash using the runit supervisor.

USE CASE 3

Enable the optional SSH server to log into a running container for debugging without needing docker exec.

Tech stack

ShellDockerUbunturunit

Getting it running

Difficulty · easy Time to first run · 5min
The explanation does not specify the license terms.

In plain English

When you run Ubuntu inside a Docker container, things break in subtle ways. Ubuntu was built for real machines or virtual servers, not containers. Its normal startup system expects hardware that is not there, and as a result containers accumulate stuck processes over time, logging stops working properly, and shutting down the container can corrupt files rather than close them cleanly. Baseimage-docker is a pre-built Docker image that fixes all of these problems before you write a single line of code. The image is built on Ubuntu 24.04 and weighs about 8.3 MB of RAM at runtime. It adds a custom startup program called my_init that correctly handles the Unix process lifecycle inside a container, meaning it adopts any orphaned child processes and cleans them up properly. It also replaces Ubuntu's default service manager with runit, a lightweight tool that can supervise multiple services and automatically restart them if they crash. Together these two pieces let you run more than one background program inside a single container without fighting the Docker model. Other additions include a syslog daemon so that the kernel and system tools can log messages normally, a cron scheduler for scheduled tasks, log rotation, and an optional SSH server (off by default) for logging into a running container to inspect what is happening. There is also a small utility called setuser that lets you run a command as a specific system user without elevated privileges. The practical benefit is that you can use baseimage-docker as the FROM line in your own Dockerfile instead of the stock Ubuntu image, and all of the corner-case configuration work is already done. You can focus on installing your application rather than patching the operating system to behave correctly in a container. The project documentation walks through adding your own services, passing environment variables in, enabling SSH, and building the image yourself if you need custom modifications. The full README is longer than what was shown.

Copy-paste prompts

Prompt 1
How do I use baseimage-docker as a FROM base in my Dockerfile and add a custom runit service that restarts automatically on crash?
Prompt 2
How do I pass environment variables into a baseimage-docker container at runtime so my app picks them up correctly?
Prompt 3
How do I enable the optional SSH server in baseimage-docker so I can log into a running container for debugging?
Prompt 4
What is my_init in baseimage-docker and why does it prevent zombie processes that accumulate in stock Ubuntu containers?
Prompt 5
How do I add a cron job inside a baseimage-docker container to run a scheduled task every hour?
Open on GitHub → Explain another repo

← phusion on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.