0

I am runnig Keycloak on a container with the default image of keycloak. I am trying to add a host to the /etc/hosts file but it is imposible. I want to change the localhost DN to ldap.demo.local Editing file from Docker Desktop container

I have also tried to edit the file from the Docker container terminal with vi and nano commands but none of that commands are recognized...

Trying to edit file from de terminal

What should I do? I need to edit this file...

Thank you in advanced!

Pau Perez
  • 11
  • 2
  • Even though you're talking about running a container and not building the image, the linked question describes the mechanisms Docker has to override DNS like this. Try to avoid changing the container filesystem using `docker exec`, since that manual change will get lost as soon as the container exits. I'd also try to avoid changing `/etc/hosts` if you can, again since that manual change will need to be repeated in every networking setup. – David Maze Jun 21 '23 at 10:37
  • In case you want to adjust some extra hosts during startup, you can always use extra_hosts in compose.yml for the service: https://docs.docker.com/compose/compose-file/compose-file-v3/#extra_hosts. (or the cli --add-host alternative). – matic1123 Jun 21 '23 at 14:28

0 Answers0