Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

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

docker build step to long in bitbucket pipelines

JT October 19, 2017

In my node project's bitbucket-pipelines.yml i am using docker build for the image. That image is then pushed to my container registry. The thing is, the docker build step is taking to long, its consuming to much build minutes compared to my local machine when building the image.

I would just like to know if there is a way to make the step faster in bitbucket pipelines like possible caching of docker build process, maybe?

Thank you in advance :D

2 answers

1 vote
Ernesto Serrano
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 20, 2018

You can increase the build time using the --cache-from feature, see an example:

 

pipelines:
default:
- step:
services:
- docker
script:
- export IMAGE_NAME=your-docker-hub/your-repo:$BITBUCKET_BRANCH
- docker login --username $DOCKER_HUB_USERNAME --password $DOCKER_HUB_PASSWORD
- docker pull $IMAGE_NAME || true
- docker build --cache-from $IMAGE_NAME -t $IMAGE_NAME .
- docker push $IMAGE_NAME

Avoid using the pipeline docker cache, only wastes time... :)

Oliver Bell
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 23, 2018

Thanks for this!

Kyle Lee
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 6, 2019

A little late but why is Bitbucket pipelines docker cache a waste of time? Haven't done enough testing but my instinct is that you are right.

For one pipe, it is not even using any build cache (which works locally).

How does `docker build --cache-from $IMAGE_NAME -t $IMAGE_NAME .` work though? Where is the cached stored? I assume it re-downloads the image each time and uses that as cache (which probably still saves a lot of time).

0 votes
gdelpino
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 25, 2017

I second this. It seems like there is a missed opportunity to make the build process faster. Downloading the image is the step taking too long (I am just downloading node:8.2.1). Maybe bitbucket can add the TLS versions of node to their list of available images so it doesn't have to download them every time?

Definitely 10 minute build times can be a bit of a problem.

EmmanuelMoralesGonzalez
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 12, 2018

did you find a solution? i 'm experienced the same issue :(

John Busciglio
Contributor
March 26, 2018

same problem here.  I chewed up 50 minutes and never even got to npm install..  

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.

Register Now
AUG Leaders

Upcoming Bitbucket Events