Public Repository

Last pushed: a year ago
Short Description
Docker Registry w/ Google Cloud Storage driver.
Full Description

docker-registry-driver-gcs

##Update, February 2015:
We've launched Google Container Registry and recommend using it instead of google/docker-registry. Google Container Registry is a private Docker registry running on Google Cloud Storage. It uses the same authentication, storage, and billing as google/docker-registry, without the need to run your own registry. Images on Google Container Registry can be accessed easily from Google Compute Engine, Managed VMs, Google Container Engine, non-Google cloud providers, or your own machines.


Docker Registry w/ Google Cloud Storage driver.

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:

     $ gcloud auth print-refresh-token
     ...your-refresh-token...
     $ cat registry-params.env
     GCP_OAUTH2_REFRESH_TOKEN=your-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
Docker Pull Command
Owner
google

Comments (2)
rimusz
2 years ago

Is the -e SEARCH_BACKEND="sqlalchemy" supported?
I cannot get it working.

Thanks

clearpursuitdocker
2 years ago

On boot2docker 1.3.2/OSX Mavericks/GCloud 0.937, the auth step to create gcloud-config container fails. Here's the trace:

Enter verification code: <blah-blah>
Traceback (most recent call last):
File “/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py”, line 170, in <module> main()
File “/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py”, line 166, in main cli.Execute()
File “/google-cloud-sdk/./lib/googlecloudsdk/calliope/cli.py”, line 385, in Execute post_run_hooks=self.post_run_hooks, kwargs=kwargs)
File “/google-cloud-sdk/./lib/googlecloudsdk/calliope/frontend.py”, line 274, in _Execute pre_run_hooks=pre_run_hooks, post_run_hooks=post_run_hooks)
File “/google-cloud-sdk/./lib/googlecloudsdk/calliope/backend.py”, line 928, in Run result = command_instance.Run(args)
File “/google-cloud-sdk/./lib/googlecloudsdk/calliope/exceptions.py”, line 78, in TryFunc return func(args, **kwargs)
File “/google-cloud-sdk/lib/googlecloudsdk/gcloud/sdktools/auth/login.py”, line 84, in Run creds = self.DoWebFlow(args.launch_browser)
File “/google-cloud-sdk/lib/googlecloudsdk/gcloud/sdktools/auth/login.py”, line 140, in DoWebFlow return c_store.AcquireFromWebFlow(launch_browser=launch_browser)
File “/google-cloud-sdk/./lib/googlecloudsdk/core/credentials/store.py”, line 339, in AcquireFromWebFlow http=_Http())
File “/google-cloud-sdk/./lib/googlecloudsdk/core/credentials/flow.py”, line 156, in Run credential = flow.step2_exchange(code, http=http)
File “/google-cloud-sdk/./lib/oauth2client/util.py”, line 129, in positional_wrapper return wrapped(
args, **kwargs)
File “/google-cloud-sdk/./lib/oauth2client/client.py”, line 1825, in step2_exchange headers=headers)
File “/google-cloud-sdk/./lib/httplib2/init.py”, line 1608, in request (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cache key)
File “/google-cloud-sdk/./lib/httplib2/init.py”, line 1350, in _request (response, content) = self._conn_request(conn, requesturi, method, body, headers)
File “/google-cloud-sdk/./lib/httplib2/init
.py”, line 1278, in _conn_request raise ServerNotFoundError(“Unable to find the server at %s” % conn.host)
httplib2.ServerNotFoundError: Unable to find the server at accounts.google.com

Help!