docker-library/docker

Depending on the docker image version, coredns rewrite regex does not work.

hehe7007 opened this issue · 2 comments

Hi, I have an issue with coredns rewrite regex not working depending on the docker image version.

Setting environment

I am usingdocker:19.03-dind and docker:18.09.1-dind in a k8s environment to create a deployment.
Below is the yaml file.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: dind-deployment18
spec:
  replicas: 1 
  selector:
    matchLabels:
      app: dind
  template:
    metadata:
      labels:
        app: dind
    spec:
      containers:
      - name: dind
        image: docker:18.09.1-dind
        securityContext:
          privileged: true 
        ports:
        - containerPort: 2375 

I used the coredns rewrite function in the K8s environment to resolve the container registry endpoint to another endpoint. (https://coredns.io/plugins/rewrite/)

  • There is no issue with rewrite name.
kubectl edit configmap coredns -n kube-system

rewrite name <Container Registry endpoint> <resolving ednpoint>
  • If you use rewrite name regex, a no such host issue occurs when logging in to docker in the docker:18.09.1-dind image.
kubectl edit configmap coredns -n kube-system

rewrite name regex <Container Registry endpoint> <resolving ednpoint>

test

kubectl exec -it <docker:18.09.1-dind podName> -c dind -- /bin/sh
# docker login -u <username> -p <pw> <Container Registry endpoint>

WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error response from daemon: Get https://<Container Registry endpoint>/v2/: dial tcp: 
lookup <Container Registry endpoint> on 169.254.25.10:53: no such host
kubectl exec -it <docker:19.03-dind podName> -c dind -- /bin/sh
# docker login -u <username> -p <pw> <Container Registry endpoint>

Login Succeeded

If regex is used, docker:19.03-dind works normally, but docker:18.09.1-dind does not work normally.
As it appears to be operating normally in docker:19.03-dind, there should be no problem with regex.
It doesn't seem to work depending on the Docker image version.
Is there a way to debug or resolve the docker:18.09.1-dind image?

Thanks!

The base image between 18 and 19 moved from alpine 3.9 to 3.10 which could explain the difference in behavior. Version 19 is 4 years old though. is there any reason you aren't using a more recent version?

@LaurentGoderre
Thank you for your reply.
Currently, the service is provided as 18.09, so it is difficult to upgrade the version.
There is no problem with version 19, but a problem occurs with version 18.
Is there any way to solve this in version 18.09?