Join 1M+ other developers and:
- Get help and share knowledge in Q&A
- Subscribe to topics of interest
- Get courses & tools that help you grow as a developer or small business owner
Build ARG in Dockerfile doesn't invalidate cache
We have a 2-stage Dockerfile (Build+run) where we use a build ARG in the 1st stage. This build ARG is injected during the
docker build ... command. When rebuilding the image with the same name and tag, but changing the build arg to something else, the value of the build ARG changes locally (can be verified by starting up the image locally), but when pushed to the DO container registry, the image still contains the old build ARG.
Is this a known issue? Is there anything in the caching mechanism than skips invalidation on ARG variables in the Dockerfile?
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.×