docker-registry の storage に Riak CS を指定してみました
Riak CS
Riak CS の環境を構築して、あらかじめ、Bucket を作成しておきます
$ s3cmd mb s3://container
docker-registry
イメージの取得
docker-registry のイメージを取得します
$ docker.io pull registry:latest
config.yml
access_key と secret_key、bucket、proxy 等の設定を追加します
common:
loglevel: info
search_backend: "_env:SEARCH_BACKEND:"
sqlalchemy_index_database:
"_env:SQLALCHEMY_INDEX_DATABASE:sqlite:////tmp/docker-registry.db"
dev:
storage: s3
boto_bucket: container
s3_access_key: GFLC3W_XLO1PBBJESTBG
s3_secret_key: SY-kACsHLvOayPUZ0q6I9GnlAR4dDAgjey4I_Q==
s3_bucket: container
s3_encrypt: false
s3_secure: false
secret_key: 4TLvi2erYFKMx0lwRx4YQTLxZryb3oG7Gu13iURsfAuy6OZgLRRJN7jPSAhgxDhH
storage_path: /images
boto_host: riak.example.com
boto_port: 8080
boto_proxy: riak.example.com
boto_proxy_port: 8080
起動
DOCKER_REGISTRY_CONFIG に config.yml を指定して起動します
$ docker.io run -d -t -p 5000:5000 -v /home/vagrant/conf:/conf -e DOCKER_REGISTRY_CONFIG=/conf/config.yml -e SEARCH_BACKEND=sqlalchemy -e SETTINGS_FLAVOR=dev registry:latest
docker push
他のホストからイメージを push します
$ docker.io push registry.example.com:5000/ubuntu-14.04
The push refers to a repository [registry.example.com:5000/ubuntu-14.04] (len: 1)
Sending image list
Pushing repository registry.example.com:5000/ubuntu-14.04 (1 tags)
511136ea3c5a: Image successfully pushed
5e66087f3ffe: Image successfully pushed
4d26dd3ebc1c: Image successfully pushed
d4010efcfd86: Image successfully pushed
99ec81b80c55: Image successfully pushed
5bd70d096094: Image successfully pushed
Pushing tag for rev [5bd70d096094] on {http://registry.example.com:5000/v1/repositories/ubuntu-14.04/tags/latest}
s3cmd で確認してみます
$ s3cmd ls s3://container/images/repositories/library/
DIR s3://container/images/repositories/library/ubuntu-14.04/
イメージの検索
$ curl -X GET http://registry.example.com:5000/v1/search 2> /dev/null
{"num_results": 1, "query": "", "results": [{"description": "", "name": "library/ubuntu-14.04"}]}
docker pull
さらに他のホストでイメージを pull してみます
$ docker.io pull registry.example.com:5000/ubuntu-14.04
Pulling repository registry.example.com:5000/ubuntu-14.04
5bd70d096094: Pulling image (latest) from registry.example.com:5000/ubuntu-14.04, end5bd70d096094: Download complete
511136ea3c5a: Download complete
5e66087f3ffe: Download complete
4d26dd3ebc1c: Download complete
d4010efcfd86: Download complete
99ec81b80c55: Download complete
$ docker.io images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
registry.example.com:5000/ubuntu-14.04 latest 5bd70d096094 13 minutes ago 266 MB