kungfuspider
kungfuspider

Reputation: 324

Docker: google/docker-registry container usage

Does the google/docker-registry container exist solely to push/pull images from Google Cloud Storage? I am currently following their instructions on Git and have the docker-registry container running, but can't seem to pull from my bucket.

I started it with:

sudo docker run -d -e GCS_BUCKET=mybucket -p 5000:5000 google/docker-registry

I have a .tar Docker image stored in Cloud Storage, at mybucket/imagename.tar. However, when I execute:

sudo docker pull localhost:5000/imagename.tar

It results in:

2014/07/10 19:15:50 HTTP code: 404

Am I doing this wrong?

Upvotes: 3

Views: 785

Answers (2)

João Luís
João Luís

Reputation: 324

When using the google/docker-registry it is preconfigured to use the google buckets.

It should work for any storage (if configuration is overriden), but it's purpose is to be used with the google infrastructure.

The tar file of an exported image should be used when there is no docker registry to manually move images between docker hosts.

You should not upload tar files to the bucket.

To upload images, you should push to the docker-registry container, it will the save the image in the bucket.

The google cloud compute instance that is running the docker registry container must be configured to have write/read access to the bucket.

Upvotes: 0

proppy
proppy

Reputation: 10504

You need to docker push to the registy instead of copying your image tar manually.

From where you image is:

docker run -ti --name gcloud-config google/cloud-sdk \
  gcloud auth login
docker run -ti --volumes-from gcloud-config google/cloud-sdk \
  gcloud config set project <project>
docker run -d -e GCS_BUCKET=bucketname -p 5000:5000 \
  --volumes-from gcloud-config google/docker-registry
docker tag imagename localhost:5000/imagename
docker push localhost:5000/imagename

Then from the place you want to run the image from (ex: GCE):

docker run -d -e GCS_BUCKET=bucketname -p 5000:5000 google/docker-registry
docker run localhost:5000/imagename

Upvotes: 4

Related Questions