I have a docker image which has 4 lower layers.
I want to reduce the size of my current image layer using multistage, but this causes a loss of environment, port and cmd config properties across the stages. Is there a way to pass on such config variables across stages in Dockerfile
.
You can do one of the following
Use a base container and set the environment values there
Other way is to use
ARGS
as below. There is some repetition but it becomes more centralisedNote examples copied from https://github.com/moby/moby/issues/37345