How to prevent creating container from a docker image?

Guest user asked:

I’d like to build a docker image which will the base of my containers, but I’d like to prevent creating a container directly from it.
Is it possible?

My answer:


You can’t prevent creating a container from your images, but you can prevent the container from running anything. Simply don’t include anything runnable in the container.

An example of a base image that does this is centurylink/ca-certs (which is horribly out of date; don’t use it for its intended purpose). It is based on scratch and its only content is a CA certificate bundle file. It is not possible to run anything from this container as it contains no scripts or executables.


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.