Skip to content
This repository has been archived by the owner on Sep 15, 2022. It is now read-only.

docker-registry: switch to plugin #23

Merged
merged 1 commit into from
Oct 28, 2014

Conversation

proppy
Copy link
Member

@proppy proppy commented Oct 6, 2014

Fixes #14

/cc @dmp42 @ktintc @bshi

@bshi
Copy link

bshi commented Oct 7, 2014

Thanks @proppy!

How hard would it be to set up a pre-release tag on index.docker.io? If it's trivial, I can do some quick testing tonight. Otherwise, I'll set up a dev environment to bake my own image tomorrow if I have some time.

@proppy
Copy link
Member Author

proppy commented Oct 7, 2014

proppy/docker-registry:plugin ;)

@bshi
Copy link

bshi commented Oct 7, 2014

Using an unchanged configuration except for the image, the container fails to start with the following errors:

  Oct 07 17:55:13 docker-repository.c.ACME-PROJECT.internal systemd[1]: docker-repository.service: main process exited, code=exited, status=1/FAILURE
  Oct 07 17:55:13 docker-repository.c.ACME-PROJECT.internal systemd[1]: Unit docker-repository.service entered failed state.
  Oct 07 17:55:43 docker-repository.c.ACME-PROJECT.internal systemd[1]: docker-repository.service holdoff time over, scheduling restart.
  Oct 07 17:55:43 docker-repository.c.ACME-PROJECT.internal systemd[1]: Stopping ACMECO Docker Repository...
  Oct 07 17:55:43 docker-repository.c.ACME-PROJECT.internal systemd[1]: Starting ACMECO Docker Repository...
  Oct 07 17:55:43 docker-repository.c.ACME-PROJECT.internal systemd[1]: Started ACMECO Docker Repository.
  Oct 07 17:55:45 docker-repository.c.ACME-PROJECT.internal docker[9513]: grep: /.config/gcloud/properties: No such file or directory
  Oct 07 17:55:45 docker-repository.c.ACME-PROJECT.internal docker[9513]: find: `/.config/gcloud/legacy_credentials//.boto': No such file or directory
  Oct 07 17:55:45 docker-repository.c.ACME-PROJECT.internal docker[9513]: /docker-registry/run.sh: line 37: wget: command not found
  Oct 07 17:55:45 docker-repository.c.ACME-PROJECT.internal docker[9513]: Boto credentials not found.  Either:
  Oct 07 17:55:45 docker-repository.c.ACME-PROJECT.internal docker[9513]: - Set GCP_OAUTH2_REFRESH_TOKEN
  Oct 07 17:55:45 docker-repository.c.ACME-PROJECT.internal docker[9513]: - Set BOTO_PATH
  Oct 07 17:55:45 docker-repository.c.ACME-PROJECT.internal docker[9513]: - Mount gcloud credentials under /.config in the container and optionally set GCP_ACCOUNT
  Oct 07 17:55:45 docker-repository.c.ACME-PROJECT.internal docker[9513]: - Run in GCE with a service account configured for devstorage access
  Oct 07 17:55:45 docker-repository.c.ACME-PROJECT.internal docker[9513]: docker run -e GCS_BUCKET=<YOUR_GCS_BUCKET_NAME> [-e GCP_ACCOUNT='<YOUR_EMAIL>' ] [-e BOTO_PATH='/.config/gcloud/legacy_credentials/<YOUR_EMAIL>/.boto'] [-e GCP_OAUTH2_REFRESH_TOKEN=<refresh token>] -p 5000:5000 [--volumes-from gcloud-config] google/docker-registry
  Oct 07 17:55:45 docker-repository.c.ACME-PROJECT.internal systemd[1]: docker-repository.service: main process exited, code=exited, status=1/FAILURE
  Oct 07 17:55:45 docker-repository.c.ACME-PROJECT.internal systemd[1]: Unit docker-repository.service entered failed state.

@proppy
Copy link
Member Author

proppy commented Oct 7, 2014

can you show the command line you used to start the container?

@bshi
Copy link

bshi commented Oct 7, 2014

Here's the systemd unit that's launching the container. See ExecStart - very basic invocation on a GCE host with the appropriate service accounts (tested the official release on this same host).

  vagrant@docker-repository /etc/systemd/system $ cat /etc/systemd/system/docker-repository.service
  [Unit]
  Description=ACMECO Docker Repository
  Author=ACMECO
  After=docker.service
  [Service]
  User=core
  Restart=always
  RestartSec=30
  TimeoutStartSec=5min
  ExecStart=/usr/bin/docker run \
        -p 80:5000 \
        -e GCS_BUCKET=acmeco-docker-repository \
        proppy/docker-registry:plugin

@dmp42
Copy link

dmp42 commented Oct 7, 2014

You likely need to review your docker-registry configuration. You guys were using 0.6, and there is a long way to 0.8. Recommandation: start from scratch using config_sample as a start point.

Also, from your logs, you are missing a couple of files (.boto, .config) and run.sh is not there - if that was supposed to launch the registry in the past (I don't rememeber for sure) there is now a simple docker-registry launch command.

Hope that helps.

@proppy
Copy link
Member Author

proppy commented Oct 7, 2014

@dmp42, I did start from scratch (noticed the <<*common) but I might have missed some important parameters.

run.sh should be the ENTRYPOINT now and it is launched docker-registry, so something might be wrong with the GCE sniffing.

@proppy
Copy link
Member Author

proppy commented Oct 7, 2014

@bshi can you run again with docker run -entrypoint "bash -x /docker-registry/run.sh"? and paste the output.

@bshi
Copy link

bshi commented Oct 7, 2014

I had to modify your command to "docker run -p 81:5000 -e GCS_BUCKET=acmeco-docker-repository --entrypoint "bash" proppy/docker-registry:plugin -x /docker-registry/run.sh" but here's the output

vagrant@docker-repository /etc/systemd/system $ docker run -p 81:5000 -e GCS_BUCKET=acmeco-docker-repository --entrypoint "bash" proppy/docker-registry:plugin -x /docker-registry/run.sh
+ USAGE='docker run -e GCS_BUCKET=<YOUR_GCS_BUCKET_NAME> [-e GCP_ACCOUNT='\''<YOUR_EMAIL>'\'' ] [-e BOTO_PATH='\''/.config/gcloud/legacy_credentials/<YOUR_EMAIL>/.boto'\''] [-e GCP_OAUTH2_REFRESH_TOKEN=<refresh token>] -p 5000:5000 [--volumes-from gcloud-config] google/docker-registry'
+ [[ -z acmeco-docker-repository ]]
+ [[ -n '' ]]
+ [[ -z '' ]]
+++ cut -d = -f 2
+++ grep account /.config/gcloud/properties
grep: /.config/gcloud/properties: No such file or directory
++ echo
+ GCP_ACCOUNT=
++ find /.config/gcloud/legacy_credentials//.boto
find: `/.config/gcloud/legacy_credentials//.boto': No such file or directory
+ BOTO_PATH=
+ [[ -n '' ]]
+ grep devstorage
+ wget -q '--header=Metadata-Flavor: Google' http://metadata.google.internal./computeMetadata/v1/instance/service-accounts/default/scopes -O -
/docker-registry/run.sh: line 37: wget: command not found
+ GCE_SA=1
+ [[ 1 -eq 0 ]]
+ echo 'Boto credentials not found.  Either:'
Boto credentials not found.  Either:
+ echo ' - Set GCP_OAUTH2_REFRESH_TOKEN'
 - Set GCP_OAUTH2_REFRESH_TOKEN
+ echo ' - Set BOTO_PATH'
 - Set BOTO_PATH
+ echo ' - Mount gcloud credentials under /.config in the container and optionally set GCP_ACCOUNT'
 - Mount gcloud credentials under /.config in the container and optionally set GCP_ACCOUNT
+ echo ' - Run in GCE with a service account configured for devstorage access'
 - Run in GCE with a service account configured for devstorage access
+ echo

+ echo 'docker run -e GCS_BUCKET=<YOUR_GCS_BUCKET_NAME> [-e GCP_ACCOUNT='\''<YOUR_EMAIL>'\'' ] [-e BOTO_PATH='\''/.config/gcloud/legacy_credentials/<YOUR_EMAIL>/.boto'\''] [-e GCP_OAUTH2_REFRESH_TOKEN=<refresh token>] -p 5000:5000 [--volumes-from gcloud-config] google/docker-registry'
docker run -e GCS_BUCKET=<YOUR_GCS_BUCKET_NAME> [-e GCP_ACCOUNT='<YOUR_EMAIL>' ] [-e BOTO_PATH='/.config/gcloud/legacy_credentials/<YOUR_EMAIL>/.boto'] [-e GCP_OAUTH2_REFRESH_TOKEN=<refresh token>] -p 5000:5000 [--volumes-from gcloud-config] google/docker-registry
+ exit 1

Looks like it's trying to invoke wget but it's not available in the image?

@proppy
Copy link
Member Author

proppy commented Oct 7, 2014

@bshi updated the image and the script with curl.

You can test it with proppy/docker-registry:plugin.

@bshi
Copy link

bshi commented Oct 7, 2014

@proppy The latest change fixes the startup issue. I'm able to pull a basic image from it. Unfortunately, it looks like the O(n) scan issue described in #22 still exists. I am however, able to pull an image with very few tags so +1 from me from this limited testing.

@bshi
Copy link

bshi commented Oct 22, 2014

Can this be merged?

@proppy
Copy link
Member Author

proppy commented Oct 22, 2014

ping @ktintc

ADD . /docker-registry
RUN ln -s /docker-registry/config.yml /docker-registry/config/config.yml
RUN apt-get update && apt-get install --no-install-recommends -yq python-pip build-essential python-dev liblzma-dev libffi-dev curl
RUN pip install docker-registry==0.8.1
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add to requirements?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually the plugin should only depends on core, but the docker image should install the registry binary manually to run it.

@ktintc
Copy link

ktintc commented Oct 22, 2014

Looks good! Thank you, @proppy! A couple of minors, squishing commits together and let's merge!

@proppy
Copy link
Member Author

proppy commented Oct 27, 2014

PTAL

@proppy proppy mentioned this pull request Oct 28, 2014
@proppy
Copy link
Member Author

proppy commented Oct 28, 2014

Also see proppy@d92f7be which default SETTINGS_FLAVOR to prod to reduce logging (Fixes: #21). You can still override it with -e SETTINGS_FLAVOR=

@ktintc
Copy link

ktintc commented Oct 28, 2014

LGTM

@proppy
Copy link
Member Author

proppy commented Oct 28, 2014

rebased, merging.

proppy added a commit that referenced this pull request Oct 28, 2014
docker-registry: switch to plugin
@proppy proppy merged commit 068f203 into GoogleCloudPlatform:master Oct 28, 2014
@proppy proppy mentioned this pull request Oct 28, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sync docker-registry with upstream
4 participants