Skip to content

Instantly share code, notes, and snippets.

@plembo
Last active June 27, 2023 05:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plembo/900853d4bfc94cad6f461e15fef97ccc to your computer and use it in GitHub Desktop.
Save plembo/900853d4bfc94cad6f461e15fef97ccc to your computer and use it in GitHub Desktop.
docker for system containers

Docker for System Containers

Docker is a popular solution for packaging applicatiom containers, but it can work equally as well for building system containers.

I've tried using lxc, and then lxd, for this, but the former requires too much tweaking (e.g. to get networking going, with sparse and outdated documentation), and the latter chases docker in a not-very-serious way. It's also only available as a snap.

The problem with creating system containers with docker is that by default they shut down immediately after creation, because there's no app or service to keep it running.

Solution

To create a docker container from an O/S image that will keep running after creation, use this command:

docker run -d debian:stable sleep infinity

A more elegant solution

If you're planning on using Ubuntu as your base system, try Baseimage-docker.

References

"How to Keep Docker Containers Running for Debugging". DevOpCube, 18 April 2021, https://devopscube.com/keep-docker-container-running/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment