Challenge, Medium,  on  ContainersLinux

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:

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 target container 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 sidecar container (busybox or alpine are good choices)
  • The sidecar container should share the PID, IPC, and network namespaces of the target container (instead of creating its own)

Good luck!

Hint: How to reproduce "docker exec" with "docker run" 💡

The below slides reveal the magic behind the cdebug tool, in particular, showing how to reproduce the docker exec-like functionality with the docker run command by starting a new container in the target container's namespaces:

Level up your Server Side game — Join 13,000 engineers who receive insightful learning materials straight to their inbox