Docker Community Forums

Share and learn in the Docker community.

Only building an image inside a container

I want to build a Docker image inside a container. I want only to build it and push to a registry. No intention to run it there. Do I still need to install a full Docker Engine inside this container or there’re some more lightweight options?

You might want to check this post:
https://jpetazzo.github.io/2015/09/03/do-not-use-docker-in-docker-for-ci/

I did. Seemed not that useful for me. I don’t want to run containers. Only build and push images. Pushing should be simple as uploading a tarball. So, is there some component of docker-ce capable of just building an image?

Hmm, you did read it and did not come to the conclusion that it drafts your solution?
Well then there is not much to say. I hope you will eventualy find what you are looking for!

The post says

Or do you just want to be able to run Docker (specifically: build, run, sometimes push containers and images) from your CI system, while this CI system itself is in a container?

Where I specifically don’t want to run containers. Moreover, I may have no access to host’s Docker socket, etc.

May I ask how you think docker builds images? Does it create containers for each intermediate layer or not?

Is “build” amongst the list of actions you pasted in your last quote?! What makes you think you have to use the other possible actions as well?

If you don’t want to use docker to build your images at all, then take a look at https://github.com/containers/buildah or https://github.com/GoogleContainerTools/kaniko.

Good luck on you journey!

I assume it does, but it may require less functionality. So, you’re saying that it use the same infrastructure and there is no sub-package. Okay, thanks for the links.