0

I'm very new to Docker and stuff, so I wonder if I can change source official and public images from Docker.Hub (which I use in FROM directive) on-the-fly, while using them in my own container builds, kinda like chefs chef-rewind do?

For example, if I need to pass build-args to openresty/latest-centos to build it without modules I won't use. I need to put this

FROM openresty/latest-centos

in my Dockerfile, and what else should I do for openresty to be built only with modules I needed?

d.ansimov
  • 2,131
  • 2
  • 31
  • 54

1 Answers1

1

When you use the FROM directive in a Dockerfile, you are simply instructing Docker to use the named image as the base for the image that will be built with your Dockerfile. This does not cause the base image to be rebuilt, so there is no way to "pass parameters" to the build process.

If the openresty image does not meet your needs, you could:

  • Clone the openresty git repository,
  • Modify the Dockerfile,
  • Run docker build ... to build your own image

Alternatively, you can save yourself that work and just use the existing image and live with a few unused modules hanging around. If the modules are separate components, you could also issue the necessary commands in your Dockerfile to remove them.

larsks
  • 277,717
  • 41
  • 399
  • 399
  • Thank you, mate. It seems like "sad but true". Thanks for a prompt reply, I'll use a private registry with my custom needs for now, as changing modules isn't the only case when I need this. – d.ansimov Aug 04 '16 at 14:29