当前位置: 动力学知识库 > 问答 > 编程问答 >

dockerfile - Docker dynamic base image name

问题描述:

I am working on a joint development with another company and we have separate docker regsitry, DNS etc. If I build a docker image and use it as base image in other projects like

FROM abc-regsitry.com/custom_centos:1.0

the other party, who will use the same source to build the image could not resolve the DNS name abc-registry.com. How can I make the docker registry prefix in the FROM directive dynamic ? Are Dockerfile templates our only option ?

网友答案:

You can set up an additional shared repository.

To copy an image to the shared repo

docker pull my-repo.com/myImage
docker tag my-repo.com/myImage shared-repo.com/ourImage
docker push shared-repo.com/ourImage

And they can do

FROM shared-repo.com/ourImage

This way they have a fixed prefix, and the image name is whatever you choose.

分享给朋友:
您可能感兴趣的文章:
随机阅读: