4

I recently upgraded docker version on my Ubuntu to latest 1.9 version. During the upgrade docker network bridge gateway has changed from 172.17.42.1 to 172.17.0.1.

I had some existing containers where the resolv.conf still points to 172.17.42.1 so whenever I restart my container the resolv.conf is resetting to 172.17.42.1. I tried to modify the /var/lib/docker/containers/<containerid>/resolv.conf but it has no effect.

Currently whenever I restart the container I connect to container and change /etc/resolv.conf file manually. This changes to this file are lost during container restart. I don't want to kill my container and re-create them again.

Is there any way to make my resolv.conf permanent for existing containers?

Thanks in advance -Kesav

1 Answer 1

0

Im building portable system that change host network a lot, the solution i found was create your container as a host and bind a volume from host resolv.conf to the container resolv.conf mainly due because if the network changes when the container is already up it will not update

here is an example of the docker-compose service declaration

  gpioctl:
    container_name: gpioctl
    image: registry.gitlab.com/absadevelopers/bluetoothgateway/bluetoothgateway_gpioctl
    network_mode: host
    volumes:
      - /var/log/knesys:/var/log/knesys
      - /etc/resolv.conf:/etc/resolv.conf:ro
    restart: unless-stopped
    depends_on:
      - nodesetup
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.