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.
Community moderators have prevented the ability to post new answers.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.