Reputation: 165
I would like to make a simple image that needs to be derived from a base image, then add a few files to it, some environment variables, and modify the entrypoint. Using a Dockerfile to do this is not ideal because running the Docker daemon inside our already-Docker pipeline means it needs to support Docker-in-Docker, which would make things more complex.
If images can just be represented as tar archives with a bunch of layers, it seems like there should be some tool that allows me to add a set of files as a new layer to an existing archive. I can't find any such tool though. It seems like I could accomplish this with the Docker CLI without involving the daemon by using the following process:
docker pull
the base imagedocker save
base image to a tar archivedocker load
the archiveManually adding a new layer in step 3 doesn't look very straightforward though, and I'm not finding a lot of examples on how to do so (which makes me think this might be discouraged in some way).
I'm not sure if I'm searching for the wrong things, but this seems like it should be a very common use case to me. I shouldn't need a daemon to just add a new layer with a few files... right?
Upvotes: 1
Views: 524
Reputation: 165
Additional research sparked by the helpful links posted here led me to an npm module that seems to make it easy to make it easy to do exactly what I want: https://github.com/google/nodejs-container-image-builder
This looks like it will make it easy to write a small node application to handle all of the heavy lifting.
Upvotes: 0
Reputation: 3895
Docker donated the format to the OCI, which in turn published the specification. The layer specification is probably where you want to start, followed by the manifest specification.
Upvotes: 1