diff --git a/labs/docker-lan/README.md b/labs/docker-lan/README.md index 8b137891..bc4d9a08 100644 --- a/labs/docker-lan/README.md +++ b/labs/docker-lan/README.md @@ -1 +1,24 @@ - +## +## 修改docker配置使用镜像和私有http仓库 +修改 /etc/docker/daemon.json 文件的 registry-mirrors 和 insecure-registries属性 +``` +{ + "registry-mirrors": [ + "https://registry.docker-cn.com", + "http://hub-mirror.c.163.com", + "https://docker.mirrors.ustc.edu.cn" + ], + "insecure-registries": ["172.20.32.1:5000"], + "debug": false, + "experimental": false, + "features": { + "buildkit": true + }, + "builder": { + "gc": { + "enabled": true, + "defaultKeepStorage": "20GB" + } + } +} +``` \ No newline at end of file diff --git a/labs/docker-lan/conf/drone/.drone.yml b/labs/docker-lan/conf/drone/.drone.yml index 7af44ff4..4581881e 100644 --- a/labs/docker-lan/conf/drone/.drone.yml +++ b/labs/docker-lan/conf/drone/.drone.yml @@ -1,19 +1,18 @@ -name: default - kind: pipeline +name: default type: docker steps: -- name: build - image: golang - commands: - - go get - - go build + - name: build + image: golang:1.12 + commands: + - go build + - go test -- name: publish - image: plugins/docker - settings: - repo: octocat/hello-world - tags: [ 1, 1.1, latest ] - registry: 172.20.32.1:5000 - insecure: true + - name: publish + image: plugins/docker + settings: + registry: 172.20.32.1:5000 + repo: 172.20.32.1:5000/go/hello-world + insecure: true + tags: [ 1, 1.1, latest ] \ No newline at end of file diff --git a/labs/docker-lan/conf/drone/Dockerfile b/labs/docker-lan/conf/drone/Dockerfile index 412b43dd..c3c78df4 100644 --- a/labs/docker-lan/conf/drone/Dockerfile +++ b/labs/docker-lan/conf/drone/Dockerfile @@ -1 +1 @@ -image: golang:alpine \ No newline at end of file +FROM alpine \ No newline at end of file diff --git a/labs/docker-lan/docker-compose.yml b/labs/docker-lan/docker-compose.yml index b03dab7c..6ca01ba9 100644 --- a/labs/docker-lan/docker-compose.yml +++ b/labs/docker-lan/docker-compose.yml @@ -31,17 +31,29 @@ services: - /proc:/host/proc:ro - /sys:/host/sys:ro - /etc/os-release:/host/etc/os-release:ro - registry: #https://docs.docker.com/registry/deploying/ + registry: #https://docs.docker.com/registry/deploying/ image: registry:2.7.1 restart: always ports: - 5000:5000 #http://localhost:5000/v2/_catalog volumes: - ./data/registry:/var/lib/registry + docker-registry-web: + image: hyper/docker-registry-web:latest + restart: always + ports: + - 9580:8080 + depends_on: + - registry + environment: + - REGISTRY_URL=http://registry:5000/v2 + - REGISTRY_TRUST_ANY_SSL=true + - REGISTRY_BASIC_AUTH=cm9vdDphQTEyMzQ1NiE= + - REGISTRY_NAME=${IP} gitea: # init with ip:port https://docs.gitea.io/en-us/install-with-docker image: gitea/gitea:1.14.2 restart: always - networks: + networks: - default environment: - USER_UID=1000