Skip to content
This repository has been archived by the owner. It is now read-only.
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Pier One - STUPS' Docker Registry

Travis CI build status Coveralls status

Docker registry with immutable tags, repo permissions, S3 backend and OAuth.


The service is written in Clojure. You need Leiningen installed to build or develop.

To start a web server for the application, you need a running PostgreSQL instance on localhost with empty pierone database (postgres/postgres as user/pass). Run the development web server with:

$ lein repl

The web server will run on port 8080. You can find the Swagger UI on http://localhost:8080/ui/.

Testing with different client versions

Use docker in docker:

For example:

`sh # First push the image $ docker push my-machine-hostname:8080/foo/bar:123 # Try to pull it using a specific version of docker (1.11) # Start the daemon $ docker run -it --privileged --name docker11 -d docker:1.11-dind --insecure-registry my-machine-hostname:8080 # Execute the command $ docker run -it --rm --link docker11:docker docker:1.11 docker pull my-machine-hostname:8080/foo/bar:123 # ... execute more commands # Stop the daemon $ docker rm -fv docker11 `


Running unit tests with code coverage report:

$ lein cloverage
$ docker pull busybox
$ docker tag busybox localhost:8080/example/foobar:1.0
$ docker push localhost:8080/example/foobar:1.0
$ docker pull localhost:8080/example/foobar:1.0


$ lein do uberjar, scm-source, docker build


Pier One supports a number of environment variables to use the Amazon S3 backend. You will need a PostgreSQL database (database schemas are created automatically on first start).

# run Pier One locally with file backend and connect to localhost PostgreSQL
# NOTE: we simply use the "host" networking hack here to connect to the localhost DB
$ docker run -it -p 8080:8080 --net=host stups/pierone
Postgres connection string, e.g "//". Default is "//localhost:5432/pierone"
Postgres password. Default is "postgres".
Postgres user name. Default is "postgres".
Allow Docker image downloads without authentication (e.g. to run Pier One as a registry for open source projects). Default is "false".
URL to get team membership information by user's UID.
OAuth2 token info URL (e.g. You can leave away this configuration property to disable OAuth authentication.
IID info URL for checking AWS Instance Identity Document based authorization. Only is enabled when HTTP_TOKENINFO_URL is also set.
Set to "verify-full" in order to fully verify the Postgres SSL cert.
Only for S3 backend: the Amazon S3 bucket name.
Set to true to start NREPL server before starting the application. Default is false.
Specify the port for NREPL server. Default is random port.
SNS topic region (notifications on pushed tags)
SNS topic arn (notifications on pushed tags)

See the STUPS Installation Guide section on Pier One for details about deploying Pier One into your AWS account.


Pier One uses OAuth 2 to protect its resources. The current implementation assumes:

  • OAuth token information contains the uid field with the user's ID (e.g. "jdoe")
  • The user's team membership can be looked up in the team service
  • Authenticated users are allowed to pull all Docker images
  • Authenticated users are allowed to push to their team's repository only

As Docker CLI only supports Basic authentication, Pier One uses a special username:


This string has to be encoded by base64 and put into ~/.docker/config.json:

  "auths": {
    "": {
      "email": "",
      "auth": "BASE64_ENCODED_AUTH_STRING"
Additionally, to support image pulling from known AWS EC2 machines, Instance Identity Document (
can be used to authenticate instead of OAuth2 token, it also uses a special username:
instance-identity-document:MIAGCSqG ... AAAAAAA

The MIAG... string can be obtained from EC2 instance profile under It's not a common use case, but Pier One CLI API can be used to generate ~/.docker/config.json:

python3 -c "from pierone.api import docker_login_with_iid; docker_login_with_iid('')"

The Pier One CLI allows configuring the Docker client with the appropriate auth credentials.


Copyright © 2015 Zalando SE

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.