get the registry mirror working
Change-Id: I17731875cf88ef30a3178c1a70181dc793c12a65
(cherry picked from commit fac79ca17d8491ab85a1c202074c407f404eab47)
diff --git a/roles/compute-node/tasks/main.yml b/roles/compute-node/tasks/main.yml
index b5d9c3a..e50cc4e 100644
--- a/roles/compute-node/tasks/main.yml
+++ b/roles/compute-node/tasks/main.yml
@@ -29,12 +29,20 @@
insertafter: '^DOCKER_OPTS'
register: docker_config
+- name: Ensure Docker Registry Mirror
+ become: yes
+ lineinfile:
+ dest: /etc/default/docker
+ line: 'DOCKER_OPTS="$DOCKER_OPTS --registry-mirror=http://docker-registry:5001"'
+ insertafter: '^DOCKER_OPTS'
+ register: docker_config_mirror
+
- name: Docker Restart
become: yes
service:
name=docker
state=restarted
- when: docker_config.changed
+ when: docker_config.changed or docker_config_mirror.changed
- name: Ensure Docker Ansible Support
become: yes
diff --git a/roles/registry/templates/registry-compose.yml.j2 b/roles/registry/templates/registry-compose.yml.j2
index 90bacc9..3db462c 100644
--- a/roles/registry/templates/registry-compose.yml.j2
+++ b/roles/registry/templates/registry-compose.yml.j2
@@ -11,10 +11,13 @@
registry-mirror:
image: registry:2.4.0
container_name: registry-mirror
+ environment:
+ - "STANDALONE=false"
+ - "MIRROR_SOURCE=https://registry-1.docker.io"
+ - "MIRROR_SOURCE_INDEX=https://index.docker.io"
volumes:
- /docker-registry-mirror/registry:/var/lib/registry/docker/registry
- /docker-registry-mirror/conf:/conf
- command: serve /conf/config.yml
ports:
- "5001:5000"
restart: unless-stopped