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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

How to add trusted certificate for docker registry?


Hi all!

I have a self-hosted docker registry with a self-sign certificate. I'm trying to push docker image to this registry but getting the following error:

x509: certificate signed by unknown authority

I can not understand why, since on my local machine (on which I'm running ci runner) everything seems to work fine (I've created a path in /etc/docker/certs.d/address_to_registry/ca.crt). I am also able to mount docker.sock to docker image and push everything to the registry.


The step that is failing looks as follows:

    - step:

          name: Deploy to Production

          deployment: Production

          runs-on: self.hosted



            - docker load --input "${IMAGE_NAME}.tar"

            - VERSION="prod-0.1.${BITBUCKET_BUILD_NUMBER}"


            - docker tag "${IMAGE_NAME}" "${IMAGE}:${VERSION}"

            - docker push "${IMAGE}:${VERSION}"


            - docker

 I don't quite understand how the docker service works. Does it not use "docker.sock" mounted to the runner? If it does it should verify my registry certificate. Maybe I'm missing something in the documentation but I have no idea how to debug this to resolve my problem. I also tried to pass the certificate to this step and install it via the "update-ca-certificates" tool but still gets the same error.


EDIT 1: The strangest thing is that in another pipeline (on same runner) I'm using images from this repository (using "image: my_repo/my_image:tag") and the image pulls with no problems. It seems like using the "services" keyword breaks everything.


EDIT 2: I'm using the "atlassian/default-image:3" for the problematic step.


Any ideas will be appreciated.

2 answers

0 votes
Norbert C Atlassian Team Mar 15, 2022

Hi @jczornik 

Thank you for contacting Atlassian Support, my name is Norbert and I'm a Bitbucket Cloud Support Engineer, it's nice to meet with you. Welcome to the Atlassian Community!

Unfortunately the problem here is that you would need to restart the Docker daemon after you did the "update-ca-certificates" command, but unfortunately it's not yet supported with PIpelines. You can read further about this on the following thread

As a workaround, can you create a certificate (for example with Letsencrypt) and set up your Docker Registry, that way that it's using the new certificates? This way, once your Runner will try to connect to the registry, it will accept the certificate.

Please let me know how it goes.

Best Regards,
Atlassian Bitbucket Cloud Support

Ok! I think I know, what is going on. If I use the docker service it does not mount the docker.sock file. Instead, it runs some kind docker in docker solution. The workaround is to define your own docker service like:

type: docker
image: docker:dind
DOCKER_HOST: "tcp://localhost:2375"

I'm not sure how to pass the certificate using the variable since for whatever reason custom variables do not accept newline characters (sick!) but it is different problem.


EDIT 1: This solution will not work either since there is no way to edit the entry point for the docker service.  

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events