5

I was reading the docs regarding docker buildx build to build to multiple architectures and I got puzzled with the --push option, it says that it pushes to the registry directly but how does it know or how can I specify where I want it to push the built images?

For more context, my plan is to push the images to my Gitlab private container registry from my Gitlab CI/CD pipeline

RabidTunes
  • 775
  • 1
  • 8
  • 21
  • 1
    just specify your registry in the tag myregistry.com/myImage:latest (and dont forget to docker login myregistry.com) – IamK Oct 03 '22 at 09:43
  • Aaaah sorry I didn't know you could specify also the registry inside the tag, I will try that as soon as I get back to my PC if you want to answer that I'll gladly accept it as an answer :D – RabidTunes Oct 03 '22 at 10:01

1 Answers1

6

First login to your private registry, with the command docker login myregistry.com. After that specify your registry in the tag name of your image docker buildx build --push -t myregistry.com/appname:version . and it should push your image to myregistry.com after build.

Note: Docker looks for either a “.” (domain separator) or “:” (port separator) to learn that the first part of the repository name is a location and not a user name.

IamK
  • 2,753
  • 5
  • 30
  • 39