• Tim Gross's avatar
    docker: generate /etc/hosts file for bridge network mode (#10766) · 2a640f0b
    Tim Gross authored
    When `network.mode = "bridge"`, we create a pause container in Docker with no
    networking so that we have a process to hold the network namespace we create
    in Nomad. The default `/etc/hosts` file of that pause container is then used
    for all the Docker tasks that share that network namespace. Some applications
    rely on this file being populated.
    
    This changeset generates a `/etc/hosts` file and bind-mounts it to the
    container when Nomad owns the network, so that the container's hostname has an
    IP in the file as expected. The hosts file will include the entries added by
    the Docker driver's `extra_hosts` field.
    
    In this changeset, only the Docker task driver will take advantage of this
    option, as the `exec`/`java` drivers currently copy the host's `/etc/hosts`
    file and this can't be changed without breaking backwards compatibility. But
    the fields are available in the task driver protobuf for community task
    drivers to use if they'd like.
    2a640f0b
To find the state of this project's repository at the time of any of these versions, check out the tags.