IBM pSeries ppc64le 下的registry v2 的安装 1. 首先配置yum源 cat >/etc/yum.repos.d/docker.repo <<EOF [docker] name=Docker baseurl=http://ftp.unicamp.br/pub/ppc64el/rhel/7_1/docker-ppc64el/ enabled=1 gpgcheck=0 EOF 2. yum -y docker-io docker-registry 3. 为docker-registry配置systemd脚本: cat > /usr/lib/systemd/system/docker-registry.service <<EOF [Unit] Description=Registry server for Docker [Service] Type=simple ExecStart=/bin/registry /etc/registry/config.yml Restart=on-failure [Install] WantedBy=muti-user.target EOF 4. 生成字签证书,并拷贝到/etc/docker/certs.d/下 a. cd /etc/registry b. cat > crt.sh <<EOF #!/bin/bash # 生成自签证书脚本 #common name默认是主机名 #CN=`hostname` CN=‘docker.repo‘ #证书名 CrtName=‘registry‘ mkdir certs;cd certs openssl req -x509 -days 3650 -subj "/CN=${CN}/" -nodes -newkey rsa:4096 -sha256 -keyout ${CrtName}.key -out ${CrtName}.crt mkdir -p /etc/docker/certs.d/${CN}:5000 && cp ${CrtName}.crt /etc/docker/certs.d/${CN}:5000 EOF 5. 修改/etc/registry/config.yml,如下: version: 0.1 log: fields: service: registry storage: cache: blobdescriptor: inmemory filesystem: rootdirectory: /dockrepo http: addr: docker.repo:5000 headers: X-Content-Type-Options: [nosniff] secret: f1bdf18afb9c7f8ab3af6a277799b3a4 tls: certificate: /etc/registry/certs/registry.crt key: /etc/registry/certs/registry.key health: storagedriver: enabled: true interval: 10s threshold: 3 6. 修改/etc/hosts文件,添加一条记录,如下: echo ‘192.168.32.233 docker.repo‘ >> /etc/hosts 7. 启动docker和docker-registry服务: service docker start service docker-registry start 8. 验证测试: docker pull docker.repo:5000/busybox(实际没有这个镜像) 如果提示 Error: image busybox:latest not found,则说明配置成功 9. 客户端(即要拉去或推送镜像的用户)要做的操作: a. mkdir -p /etc/docker/certs.d/docker.repo:5000 b. scp [email protected]/tmp/registry.crt /etc/docker/certs.d/docker.repo:5000/ c. echo ‘192.168.32.233 docker.repo‘ >> /etc/hosts d. service docker restart
时间: 2024-10-14 04:33:39