Skip to content

proppy/docker-registry

 
 

Repository files navigation

Docker-registry

Sources for google/docker-registry, Docker Registry image to push/pull your Docker images to/from Google Cloud Storage.

Usage

After google/docker-registry is built or pulled from the public registry you can push/pull docker images to/from your Google Cloud Storage bucket.

Specifying the bucket

You need to specify the GCS bucket to store your images in. To do that, set the GCS_BUCKET environment variable when running the Docker container.

docker run -d -e GCS_BUCKET=your-bucket -p 5000:5000 google/docker-registry

You can optionally set the STORAGE_PATH environment variable to specify the path to the registry location inside the bucket. Make sure to have a leading slash and not have a trailing one in the path specification.

docker run -d -e GCS_BUCKET=your-bucket -e STORAGE_PATH=/containers -p 5000:5000 google/docker-registry

Credentials

There are three ways to specify the credentials:

  1. Specify the Google Cloud Platform OAuth refresh token directly in an environment variable. It is best to put this in an --env-file so it can't be seen with ps when not running detached. Example:

     $ cat registry-params.env
     GCP_OAUTH2_REFRESH_TOKEN=refresh-token
     GCS_BUCKET=your-bucket
     $ docker run -d --env-file=registry-params.env -p 5000:5000 google/docker-registry
    
  2. A .boto file in the /.config directory in the docker-registry container. The easiest way to do this is to use the google/cloud-sdk Docker image to create these credentials, and import its /.config volume using --volumes-from.

    $ docker run -ti --name gcloud-config google/cloud-sdk gcloud auth login
    Go to the following link in your browser:
    
        https://accounts.google.com/o/oauth2/auth [snip]
    
    Enter verification code: [snip]
    
    You are now logged in as [you@gmail.com].
    Your current project is [None].  You can change this setting by running:
      $ gcloud config set project <project>
    
    $ docker run -ti --volumes-from gcloud-config google/cloud-sdk \
        gcloud config set project <project>
    
    $ docker run -d -e GCS_BUCKET=your-bucket -p 5000:5000 \
        --volumes-from gcloud-config google/docker-registry
    
  3. Run on Google Compute Engine with a properly configured service account:

     $ gcutil addinstance --zone=us-central1-a --machine_type=f1-micro \
         --image=projects/google-containers/global/images/container-vm-v20140522 \
         --service_account_scopes=storage-rw \
         my-docker-vm
    
     [snip]
    
     $ gcutil ssh my-docker-vm
     $ sudo docker run -d -e GCS_BUCKET=your-bucket -p 5000:5000 google/docker-registry
    

Using the registry

docker tag myawesomeimage localhost:5000/myawesomeimage
docker push localhost:5000/myawesomeimage

Building google/docker-registry image

docker build -t google/docker-registry .

Notes

Current image size: 257.4 MB

About

Registry server for Docker (hosting/delivering of repositories and images)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 85.3%
  • Go 7.4%
  • Shell 7.3%