Any way to build an image within a container?

I’m making a website builder that allows the user to deploy their newly minted site. My web server is containerized, as is the service that takes a JSON input and creates a new project directory in /var/usersite/sitename (that’s a volume). I have another container exposing the Docker remote API for requests.

I am writing a Dockerfile to each new Project directory, but right now, I don’t know how to go about building it. It seems Docker remote API only accepts streams to build images, but what I need is a way to run build once the Project directory has been created.

I’ve got a solution, but can’t find a clear way to close or delete the post.

How about you post your solution for the next person coming along?

1 Like