according to docs for pulling from and pushing to a local registry, you have to tag an image like this :
docker image tag rhel-httpd:latest registry-host:5000/myadmin/rhel-httpd:latest
docker image push registry-host:5000/myadmin/rhel-httpd:latest
right now I have a lot of deployments and helm charts in my on-prem k8s cluster and it's not really convenient to rename all the reference images every time our registry address changes. is there any way to change the default registry without tagging the images?
i'm using registry:2
image to run a local docker registry with docker compose like this:
version: "3"
services:
registry:
image: registry:2
ports:
- 5000:5000
environment:
- REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY: /data
restart: unless-stopped
volumes:
- ./data:/data
CodePudding user response:
so as David Maze suggested and as it's been discussed in this answer and this issue it's best that we don't change the default registry.
I ended up using a parameter inside my helm chart's values.yaml
file.
just an example of how it could be done :
#values.yaml
docker_registry: my.local.registry/
image_name: my_image_name
and then in any template that's addressing the image use {{ .Values.docker_registry}}{{ .Values.image_name}}
instead of {{ .Values.image_name}}
we can also use the default registry by setting docker_registry : docker.io/