Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Override FROM image's ENV in Dockerfile

From the following image: https://registry.hub.docker.com/u/cloudesire/activemq/dockerfile/

If I wanted to override the ACTIVEMQ_VERSION environment variable in my child docker file, I assumed I would be able to do something like the following:

FROM cloudesire/activemq:latest
MAINTAINER abc <[email protected]>
ENV ACTIVEMQ_VERSION 5.9.1
ADD ./src/main/resources/* /opt/activemq/conf/

However this does not seem to work. Admittedly I am new to Docker and have obviously misunderstood something. Please could someone explain why this does not work, and how/if I can achieve it another way?

like image 987
James Avatar asked Mar 15 '23 04:03

James


1 Answers

That won't work. The ACTIVEMQ_VERSION has already been used by the cloudesire/activemq:latest image build to populate its image layers. All the ActiveMQ installation files based on version 5.11.1 are already extracted in their corresponding directories.

In your Dockerfile you only can build on top of what has already been build there and add your files. Your own Dockerfile build will not re-run the build instructions described in their Dockerfile.

If you need to have your own cloudesire/activemq image based on version 5.9.1 you need to clone their Dockerfile, adjust the version there and build it locally. So you could base your other Dockerfile on it.

like image 96
Henrik Sachse Avatar answered Mar 24 '23 16:03

Henrik Sachse