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

Docker Image Artifact unavailable on Following Steps



I am trying to build a docker image in one step, and then deploy it to a container registry in another step. I am following the example laid out in Bitbucket pipeline Validator. My steps look like this:

- step: &build-docker-image
name: Build Docker Image
- maven
- docker
- node

- ./mvnw verify -Pprod -DskipTests
- WARFILE=( "target"/*.war )
- echo $WARFILE
- cp $WARFILE src/main/docker/app.war
- docker build -t foobar -f src/main/docker/Dockerfile src/main/docker
- docker save foobar --output foobar-dockerimg.tar
- docker
- foobar-dockerimg.tar

This step runs successfully, and the output indicates that it has successfully stored the artifact (the artifact is also available for download in the Artifacts tab for the Step):

Searching for files matching artifact pattern foobar-dockerimg.tarArtifact pattern foobar-dockerimg.tar matched 1 files with a total size of 205 MiBCompressed files matching artifact pattern foobar-dockerimg.tar to 167 MiB in 9 secondsUploading artifact of 167 MiBSuccessfully uploaded artifact in 9 seconds

This is the second task that needs to use the artifact to publish:

- step: &publish-docker-img-prodcr
name: Publish Artifacts -> Prod CR
- maven
- docker
- node
- echo "*** Publishing Application Version:${CVC_APP_VERSION} to ${AZ_CR_SERVER_PROD}"
- ls -lah
- pwd
- docker load --input ./foobar-dockerimg.tar
- ... publishing stuff...
- docker
- foobar-dockerimg.tar

When the step executes, the "Build setup" output indicates that it has successfully downloaded my artifact:

Artifact "foobar-dockerimg.tar": DownloadingArtifact "foobar-dockerimg.tar": Downloaded 167 MiB in 5 secondsArtifact "foobar-dockerimg.tar": ExtractingArtifact "foobar-dockerimg.tar": Extracted in 1 seconds

Unfortunately, the `docker load --input ./foobar-dockerimg.tar` command in the second step always fails with the message:

+ docker load --input ./foobar-dockerimg.tar

open ./foobar-dockerimg.tar: no such file or directory


The `ls -lah` command in the step confirms that the foobar-dockerimg.tar artifact is not available in the build directory (i.e. this doesn't appear to be an issue with the `docker load` command. 

Is there something I am missing with respect to how artifacts work? Am i doing anything obviously wrong here?

1 answer

On a related note, I tried replacing the docker image .tar file with a vanilla text file (so, in Step #1 the artifact is created via `touch foobar.txt` and I add some data via `echo "some data" >> foobar.txt`. This foobar.txt file artifact is successfully delivered to my build workspace on Step #2.

The fact that the foobar.txt file is being delivered properly on Step #2 suggests that my general approach to publishing and consuming artifacts between steps is valid. I suspect one of two things is going on:

  1. The docker image .tar file is too large, or some other system constraint is preventing a successful download. In any case, the Bitbucket logging doesn't indicate any constraint violation.
  2. There is a bug in pipelines, where the artifact isn't downloaded successfully to the workspace, or, the build steps are kicked off before the artifact is downloaded successfully.

Of course, I could also be missing something obvious. But my approach here is based on the Docker example provided by Bitbucket, so I'm not sure what I could be doing wrong.

Same exact thing is happening with me. 

End of the build output:

Successfully built a9da703464ce
Successfully tagged blahbuild:0.1.1
mkdir ./build-artifacts
docker save -o build-artifacts/blahbuild_0.1.1.tar blahbuild:0.1.1
dir -ls build-artifacts/*
15238784 -rw------- 1 root root 15604507648 Jun 10 19:37 build-artifacts/blahbuild_0.1.1.tar


As you can see the tar file is 15GB.

Nothing in the Artifacts tab.

Probably the size.

Suggest an answer

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

📣 Calling Bitbucket Data Center customers to participate in research

Hi everyone, Are you Bitbucket DC customer? If so, we'd love to talk to you! Our team wants to dive deep to understand your long-term plans regarding Bitbucket DC and Atlassian Cloud. Do you plan...

84 views 2 3
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