Friday, 21 April 2023

docker compose

extra_hosts

Add hostname mappings. Function the same as the docker client --add-host parameter.

//example
extra_hosts:
  - "somehost:162.242.195.82"
  - "otherhost:50.31.209.229"

An entry with the ip address and hostname is created in /etc/hosts inside containers for this service

host.docker.internal

For docker for mac or window, it is docker host ip. However, for docker for Linux, need to add this in compose file

#For docker for Mac or Window, should not add this. Otherwise,
#host.docker.internal may not be host ip.  It is for Linux only
extra_hosts:
    - host.docker.internal:host-gateway

No comments:

Post a Comment