Reputation:
So far I have only seen images with some operating system as a base layer. Is this necessary ? Is it possible to run some container without an operating system ?
Upvotes: 1
Views: 83
Reputation: 263627
There is FROM scratch
which you'll find if you follow how the images on docker hub have been built (you may have to follow various FROM x
lines to different images until you reach scratch). Scratch is empty, completely empty, no libraries, no shells, no files at all. It's designed as a starting point that you can copy a bunch of files into.
You can also use scratch if you have a statically linked binary and don't want anything else inside the container. However note that debugging the container becomes more difficult since you can't launch a shell inside the container, but that also means attackers can't do that either.
Upvotes: 0
Reputation: 6079
An operating system consist of the kernel and userland utilities. So, there are no Docker images with "operating systems" as base layer, but a lot of images named after operating system distributions with their particular userland utilities.
You can create a Docker image from a tarball with anything you like. But it wouldn't be useful if it lacks /bin/sh and you want to include a RUN in the Dockerfile.
Upvotes: 1