If I'd like to build a docker image in one pipeline step, then use it in a following step - how would I do that?
eg
default:
- step:
name: Build
image:
script:
- docker build -t imagename:local .
- docker images
- step:
name: Deploy
image:
script:
- docker images
In this example, the image shows up in the first step, but not the second
Bitbucket uses git under the hood and git is an excellent place to store text files, such as Dockerfile. It does support storing binary files but it is not a good match for Docker images.
You would use Docker Save/Load in conjunction with bitbucket artifacts.
Example:
- step:
name: Build docker image
script:
- docker build -t "repo/imagename" .
- docker save --output tmp-image.docker repo/imagename
artifacts:
- tmp-image.docker
- step:
name: Deploy to Test
deployment: test
script:
- docker load --input ./tmp-image.docker
- docker images
Source: Link
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With