In my pipeline first step I build a docker container which I want to use in my following steps. Is this possible?
Thank you
@Nagore Garcíayes, sure, you can do it, just ensure you put building-pushing container step before actions where you use this image
In this case how do I do it?
pipelines:
default:
- step:
name: initialize
script:
- docker build -f Dockerfile.build -t app .
- docker run --rm -t -d --name app app
name: clean
script: - docker stop app
@Nagore García
Basically, you may want to build and push to some registry image firstly.
In this case you can use it as in this documentation
https://support.atlassian.com/bitbucket-cloud/docs/use-docker-images-as-build-environments/
or as a service - for service definition have a look at https://support.atlassian.com/bitbucket-cloud/docs/databases-and-service-containers/ doc.
But if you don't want to push, you may want to use docker save/docker load command and pass image archive created by docker save through artifacts.
I guess, this is non-standard solution, for best practice it would be better to push image (e.g., dockerhub allows to store several private repos for free).
Regards, Galyna
It looks like you're new here. Sign in or register to get started.