docker build --target build_stage_target -t build_name .
Running the above command in my pipelines does not produce the desired results. The --target flag is apparently ignored, and the build runs all stages before and after the specified stage.
Is this indeed not supported or could I be doing something wrong?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Jason Ryan 👋
In our team we found the answer. This is not a Bitbucket issue, but the Docker itself. BuildKit fixes this bug in multi-stage builds in the legacy docker build engine.
So, just enable the BuildKit by inserting the line
- export DOCKER_BUILDKIT=1
before the docker build command and the image will be built with the specified target.
So simple, bro))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.