Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pull docker images from a private repository during docker build?

Is there any way of pulling images from a private registry during a docker build instead of docker hub?

I deployed a private registry and I would like to be able to avoid naming its specific ip:port in the Dockerfile's FROM instruction. I was expecting a docker build option or a docker environment variable to change the default registry.

like image 665
Julio Guerra Avatar asked Jun 18 '15 07:06

Julio Guerra


People also ask

How do I access private Docker images?

Navigate to Docker Hub create a Docker ID and select the personal subscription. Using docker login from the CLI, log in using your original Docker ID and pull your private images. The private images that existed in your previous namespace are now available in your new Docker ID namespace.

How do I run a docker image from a repository?

Run docker build -t <your_username>/my-private-repo . to build your Docker image. Run docker run <your_username>/my-private-repo to test your Docker image locally. You must be signed in to Docker Hub through Docker Desktop or the command line, and you must also name your images correctly, as per the above steps.


1 Answers

The image name should include the FQDN of the registry host. So if you want to FROM <some private image> you must specifiy it as FROM registry_host:5000/foo/bar

In the future this won't be a requirement, but unfortunately for now it is.

like image 180
cpuguy83 Avatar answered Sep 22 '22 02:09

cpuguy83