First, the environment centos7
Mirror: docker.io/registry # v2
Docker-Registry-Web
Second, start the warehouse-ui and Web
1. OS build docker Services (slightly)
2. Create a registry frontend in the home directory mkdir -p registry frontend []
3. Create a registry / config.yml
cat registry / config.yml
version: 0.1
log:
level: info
formatter: text
fields:
service: registry
environment: production
storage:
cache:
layerinfo: inmemory
filesystem:
rootdirectory: /var/lib/registry
delete:
enabled: true # 要在 ui 上能够删除镜像,enable 的值必须是 true
http:
addr: :5000
debug:
addr: :5001
4. Create frontend / config.yml
cat frontend/config.yml
registry:
url: http://registry:5000/v2 # Docker registry url
name: localhost:5000 # Docker registry sea
readonly: false # To allow image delete, should be false
auth:
enabled: false # Disable authentication
5. Start the service
registry listening port 5000, and a host of image files stored in / home / registry / storage host.
docker run -d -p 5000:5000 --restart=on-failure:3 --name registry -v $(pwd)/registry/:/etc/docker/registry:ro -v /home/registry/storage:/var/lib/registry registry:latest
docker run -d -p 10080: 8080 --restart = on-failure: 3 --name registry-frontend --link registry -v $ (pwd) / frontend /: / conf /: ro docker-registry-web: latest
or convenient started by a script
startup.sh CAT
#! / bin / bash
#registry listen in / home / registry / storage host port 5000, and the image file storage host.
docker run -d -p 5000:5000 --restart=on-failure:3 --name registry -v $(pwd)/registry/:/etc/docker/registry:ro -v /home/registry/storage:/var/lib/registry registry:latest
#ui monitor host port 10080
docker run -d -p 10080:8080 --restart=on-failure:3 --name registry-frontend --link registry -v $(pwd)/frontend/:/conf/:ro docker-registry-web:latest
6. The modified web-ui to port 80, or 8080
to modify the above to port 10080 8080. Example:
. A Registry Docker STOP STOP-frontend && systemctl Docker
B modified container inside the container configuration file (NOTE To stop a docker. master daemon process, otherwise the changes will not take effect configuration items, the master daemon process memory configuration values will override the values you modified) vi /var/lib/docker/containers/8f5a900a3227ae96f4a2210ab7168644ed06f752bcbbe84a6bfb7599cdf77a81/hostconfig.json
"PortBindings": { "8080 / tcp ": [{" HOSTIP ":" "," HostPort":"10080
"}]} HostPort":"10080
modification to HostPort":"8080
save
7.systemctl start docker && docker start 8f
view of the container running, and whether the port mapping changes over docker ps | grep registry