Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Can I use the same docker container in pipeline diferent steps?

In my pipeline first step I build a docker container which I want to use in my following steps. Is this possible?

Thank you

1 answer

0 votes

@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

- step:

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

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

Admins, notify your Jira instance of system-wide changes with the new admin announcement banner

Hi All! We’re excited to share the launch of an announcement banner that lets Jira site administrators communicate directly to their users across their  Jira Cloud instance.  ...

532 views 15 17
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you