Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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 you share a docker service between steps? Edited

Imagine I had a pipeline where step 1 created a Docker image and step 2 deployed it to a container registry.

I appreciate I could create a Docker image with both Java and Azure CLI installed and use that in one step but I'm interested if I could do it without that.

Without the "caches" sections, it doesn't look like the docker service in the example below keeps the image after the step has completed.

pipelines: 
default:
- step:
image: adoptopenjdk/openjdk11
services:
- docker
# caches:
# - docker
script:
- docker pull docker/whalesay
- docker images
- step:
image: microsoft/azure-cli
services:
- docker
# caches:
# - docker
script:
- docker images

The whalesay image downloaded in step 1 is no longer in docker at the beginning of step 2.

If I add "caches" sections. It does seem to keep the downloaded docker image but the repository and tag details disappear?


"docker images" output from step 1:

REPOSITORY TAG IMAGE ID CREATED SIZE

docker/whalesay latest 6b362a9f73eb 4 years ago 247MB

"docker images" output from step 2:

REPOSITORY TAG IMAGE ID CREATED SIZE

<none> <none> 6b362a9f73eb 4 years ago 247MB

 

1 answer

1 accepted

0 votes
Answer accepted

Hi Mark,

The only way to share information between steps is using caches or artifacts (or an external service like an artifact repository). The recommended way to build and deploy a docker image is to do it all in a single step.

If you don't want to use a single image that includes all the required dependencies then another option is to use a "docker run" command to perform one of the operations. For example you can deploy using a "docker run" command within your script (based on an image that contains the azure cli).

Another option is to use a pipe such as https://bitbucket.org/microsoft/azure-cli-run/src/master/ to perform the deploy (the pipe actually just uses "docker run" under the hood).

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket Pipelines

Bitbucket Pipelines Runners is now in open beta

We are excited to announce the open beta program for self-hosted runners. Bitbucket Pipelines Runners is available to everyone. Please try it and let us know your feedback. If you have any issue...

762 views 15 10
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