This article describes how to build a localized Docker image warehouse on the POWER8 server, which involves mirroring production, Docker Registry service startup, and so on. I want to be able to provide reference for the students who build Docker warehouses on non-X86 servers.
Disclaimer: This article is only used as a personal learning!
The first step is to start a KVM virtual machine (ip:172.16.13.221) on the server, compile the Docker build executable, and start the Docker daemon service. Refer to one of my other documents.
Second step, make registry image
Because there is no Docker registry mirror in the Ubuntu environment, you need to make your own
1, make ubuntu14:04 base image
$ sudo apt-get install-y debootstrap
$ Curl-o debootstrap.sh Https://raw.githubusercontent.com/docker/docker/master/contrib/mkimage/debootstrap
$ chmod 755 debootstrap.sh
$ sudo./debootstrap.sh Ubuntu--components=main,universe Trusty
$ sudo tar-c ubuntu-c. | Docker import-ubuntu:14.04
$ docker Tag ubuntu:14.04 ubuntu:trusty
$ docker Tag ubuntu:14.04 ubuntu:latest
$ sudo rm-fr ubuntu
$ Docker Images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
Ubuntu 14.04 78c113d93188 seconds ago 197.6 MB
Ubuntu latest 78c113d93188 seconds ago 197.6 MB
Ubuntu trusty 78c113d93188 seconds ago 197.6 MB
2, download Docker-registry
$git clone https://github.com/docker/docker-registry
3, patching
$ CD ~/docker-registry
$ cat ~/docker-registry/docker-registry.patch
* * * docker-registry.orig/dockerfile Sat Jan 07:20:32
---docker-registry/dockerfile Sat Jan 13:12:11
***************
* * * * 19,24
---19,27----
libssl-dev \
liblzma-dev \
libevent1-dev \
+ # Install deps for building gevent
+ Curl \
+ cython \
&& rm-rf/var/lib/apt/lists/*
COPY. /docker-registry
***************
27,32 * * *
---30,45----
# Install Core
RUN Pip Install/docker-registry/depends/docker-registry-core
+ # Install gevent 1.0.1 using updated config.guess and Config.sub
+ RUN Curl https://pypi.python.org/packages/source/g/gevent/gevent-1.0.1.tar.gz | tar-xzf-c/\
+ && Curl-o/gevent-1.0.1/libev/config.guess \
+ ' Http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD ' \
+ && Curl-o/gevent-1.0.1/libev/config.sub \
+ ' Http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD ' \
+ && cp-pf/gevent-1.0.1/libev/config.guess/gevent-1.0.1/c-ares/config.guess \
+ && cp-pf/gevent-1.0.1/libev/config.sub/gevent-1.0.1/c-ares/config.sub \
+ && pip install/gevent-1.0.1
+
# Install Registry
RUN pip install file:///docker-registry#egg=docker-registry[bugsnag,newrelic,cors]
$ pAtch-p1 < Docker-registry.patch
4, make registry image
$ Docker build-t registry.
Removing intermediate container bc9ea34e0252
Successfully built 2BE3E95C5B2F
Step three, start the Registry service
$ Docker run-d-P 5000:5000 Registry
[2015-12-09 06:28:48 +0000] [1] [INFO] starting Gunicorn 19.1.1
[2015-12-09 06:28:48 +0000] [1] [INFO] Listening at:http://0.0.0.0:5000 (1)
[2015-12-09 06:28:48 +0000] [1] [INFO] Using worker:gevent
[2015-12-09 06:28:48 +0000] [INFO] booting worker with pid:13
[2015-12-09 06:28:48 +0000] [INFO] booting worker with pid:14
......
$ docker PS
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
266b27fb6d5b Registry "Docker-registry", seconds ago up seconds 0.0.0.0:5000->5000/tcp Goofy_jennings
Fourth Step, upload image to registry
I always get a connection error when I upload a mirror in a KVM with a registry container, but it's not resolved. Try uploading it in another KVM, and the results are successful.
1, launch Docker Daemon
2 in another KVM, use Docker import to put previously crafted files into the local docker system
3, configure the docker.conf file, set the registry address (172.16.13.221:5000), use the--insecure-registry parameter, and then restart Docker Daemon.
Add
docker_opts= "--insecure-registry 172.16.13.221:5000" in/ect/init/docker.conf
$ps-aux
/usr/bin/docker Daemon--insecure-registry 172.16.13.221:5000
4. Tag the image you want to upload
$ docker tag f3b2472e2593 172.16.13.221:5000/ubuntu
$ docker Images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
172.16.13.221:5000/ubuntu latest f3b2472e2593 2 days ago 188.3 MB
Ubuntu 14.04 f3b2472e2593 2 days ago 188.3 MB
Ubuntu latest f3b2472e2593 2 days ago 188.3 MB
Ubuntu trusty f3b2472e2593 2 days ago 188.3 MB
5,push image (transmission may be interrupted, need to try several times)
$ Docker push 172.16.13.221:5000/ubuntu
The push refers to a repository [Localhost:5000/ubuntu] (Len:1)
Sending image list
Pushing repository 172.16.13.221:5000/ubuntu (1 tags)
F3b2472e2593:image successfully pushed
$ Docker Search 172.16.13.221:5000/ubuntu
NAME DESCRIPTION STARS Official automated
Library/ubuntu 0
Resources:
Build and use Docker on the IBM POWER Linux platform
https://www.ibm.com/developerworks/library/d-docker-on-power-linux-platform/
Build Docker Registry Service on Ubuntu14.04 system POWER8 Server