Docker: disable pulling from remote registry

2019-04-28 17:29发布

When I mistype things it tries to search in the central registry. How to disable it completely?

Is there an option to clear that URL?

标签: docker
2条回答
手持菜刀,她持情操
2楼-- · 2019-04-28 17:44

As a reference, right now (docker 1.9, Nov 2015):

  • pull.go looks for pull endpoints:

    s.registryService.LookupPullEndpoints()
    
  • registry/service.go looks for V2 endpoint:

    s.lookupEndpoints(repoName)
    
  • registry/service_v2.go appends DefaultV2Registry:

    endpoints = append(endpoints, APIEndpoint{
        URL:          DefaultV2Registry,
    
  • registry/config_unix.go includes DefaultV2Registry:

    DefaultV2Registry = "https://registry-1.docker.io"
    

So until there is an option to not look for that endpoint, docker pull will still include that central default V2 registry.

查看更多
劳资没心,怎么记你
3楼-- · 2019-04-28 17:50

If you use the a redhat clone with the rpms from centos extras, they have a parameter to do that:

--block-registry hostname

This is a RedHat extension (see here) which I don't think was accepted upstream (considering 13450)

查看更多
登录 后发表回答