Skip to content

Conversation

@kvinwang
Copy link
Collaborator

@kvinwang kvinwang commented Jan 27, 2026

Summary

Add a utility script that creates an isolated temporary docker environment for running docker commands before the system dockerd is started.

Use Case

During early boot (e.g., in init_script), we may need to run docker containers to install software before the system dockerd service starts. This script provides a clean way to do that.

Features

  • Starts temporary containerd and dockerd with unique state directories
  • Cleans up completely on exit (processes, mounts, files)
  • Handles signals (EXIT, INT, TERM) properly
  • Has timeout protection for socket readiness
  • Preserves command exit codes

Usage

# Run a single docker command
ephemeral-docker.sh run --rm hello-world

# Install software via privileged container
ephemeral-docker.sh run --rm --privileged --pid=host --net=host -v /:/host \
  some-installer-image:latest

Test plan

  • Run ephemeral-docker.sh run --rm hello-world
  • Verify cleanup after normal exit
  • Verify no leftover processes or mounts

…ment

This script creates an isolated temporary docker environment that:
- Starts temporary containerd and dockerd with unique state directories
- Cleans up completely on exit (processes, mounts, files)
- Handles signals and timeouts properly
- Preserves command exit codes

Useful for running docker commands before the system dockerd is started,
e.g., during early boot in init scripts.
@kvinwang kvinwang enabled auto-merge January 27, 2026 13:04
@kvinwang kvinwang merged commit 8e35ef3 into master Jan 27, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants