Hello,
I m new here.
i want to know about how i can use bitbucket pipeline that build docker image with bitbucket repo and then push to dockerhub.
please guide me.
thank you.
Hello Hardik,
You can use Docker in Pipelines, in a similar manner to how you do so locally.
Here's an example bitbucket-pipelines.yml configuration that enables Docker, and does a build and push.
pipelines:
default:
- step:
services:
- docker # Enables Docker in this specific step of your pipeline.
script:
- docker build -t my-image:version .
- docker login -u dockerhub_username -p $DOCKER_PASSWORD
- docker push my-image:version
I recommend that you use secured variables for your DockerHub password, so that it doesn't show in the logs.
We have more details information about Docker inside of Pipelines here: https://confluence.atlassian.com/bitbucket/run-docker-commands-in-bitbucket-pipelines-879254331.html
If you're still new to Docker, I recommend you work through the Docker tutorials locally to get comfortable with how it works first: https://docs.docker.com/get-started/
Thanks,
Phil
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.