Registry
  • Public registry, docker hub
  • Private registry, ECR (AWS), ACR (Azure), GCR (Google)
  • Local registry
  • Image Naming
    registryDomain/imageName:Tag
    
    Docker Hub
    docker.io/library/imageName:Tag
    or
    imageName:Tag
            
    Login Registry
    docker login # login Docker Hub
    docker login [domainName] # login a private registry
            
    Private Registry
  • ECR
  • Local Registry
    # start a local registry
    docker run -d -p 5000:5000 --restart=always --name registry registry:2
    
    # push image
    docker tag redis localhost:5000/redis
    docker push localhost:5000/redis
    
    # pull image
    docker pull localhost:5000/redis
    
    # list images on local registry
    http://localhost:5000/v2/_catalog
            
    Multiple Registries
  • Compose file contains images from multiple registries
  • version: "3.9"  # optional since v1.27.0
    services:
      mysqlserver:
        image: [privateRegistry]/mysql:8 # pull from a private registry
        volumes:
          - type: volume
            source: sandbox-home
            target: /var/lib/mysql
        environment:
          - MYSQL_ROOT_PASSWORD=root
      phpmyadmin:
        image: phpmyadmin/phpmyadmin # pull from Docker Hub
        ports:
          - 8080:80
        environment:
          - PMA_HOST=mysqlserver
    volumes:
      sandbox-home:
            
  • Login registries
  • # ~/.docker/config.json
    {
    	"auths": {
    		"https://index.docker.io/v1/": {},
    		"[privateRegistry]": {}
    	},
    	"credsStore": "desktop"
    }
            
    Reference
  • Using a Private Docker Registry
  • Deploy a Registry Server