Search code examples
dockerraspberry-piraspbianraspberry-pi-zero

Docker base image from my current os configuration


I need some clarifications about Docker Base Os image.

In particular, I'd like to know if it is possible to create a docker base os from the image running on my Raspberry. If I understand correctly, the right way to use docker involves the use of a new installation of the (for instance Raspbian) Os and create the containers that have to be run on top of this clean Os.

By the way, on my Raspbian Os, there are a lot of configurations, and different processes (and so on) developed along the last years.

So, is there any possibility to create a Docker container that reflects my version of the Raspbian Os? And eventually, Do I have to load it normally using the FROM keyword?

Thanks


Solution

  • Actually you can create your own images, which do not have base images. That is called scratch.

    You still have to start you Dockerfile with FROM scratch as soon as this is a requirement - to have FROM at the beginning:

    The FROM instruction initializes a new build stage and sets the Base Image for subsequent instructions. As such, a valid Dockerfile must start with a FROM instruction.

    But in this particular case no real image would be downloaded - it is treated as a reserved word.

    This is the source: https://hub.docker.com/_/scratch