Run a Sidecar Container in the Namespace of Another Container
Learn how to run multiple Docker containers sharing the same PID, IPC, and network namespaces - a foundation of many advanced container use cases, including Kubernetes Pods construction and container debugging tools.
Premium Challenge
Upgrade your membership to unlock this and all other premium materials.
While there might be no immediate practical use for this in a regular Docker workflow, sharing namespaces between containers is a widely used technique employed by:
- Kubernetes Pods, including ephemeral containers
- Container debugging tools (
cdebug,docker debug,kubectl debug, etc.) - Infrastructure projects (e.g., iximiuz Labs playground engine)
In this challenge, you'll need to start a new container in the namespaces of another, already running container, effectively making it a sidecar:
- The
targetcontainer is a simple HTTP API server that already runs in the background - You need to start a new container, called
sidecar, that runs an interactive shell inside - You can use any image for the
sidecarcontainer (busyboxoralpineare good choices) - The
sidecarcontainer should share the PID, IPC, and network namespaces of thetargetcontainer (instead of creating its own)
Good luck!




