Files
weave/website/tasks/weave-docker-api/name-resolution-proxy.md
T
Raj Chaudhuri e2db8a25bd Added documentation website content, and a workflow to publish it to GitHub Pages
* Copied, rearranged and modified the contents of the old site directory for Jekyll static site generator, into the website directory
* Added some Jekyll-specific things for looks, including:
  * _config.yaml, Gemfile.* and 404.html files
  * _data, _layouts and assets directories and their content
* Added .github/workflows/github-pages-publish.yml workflow
2024-03-18 20:37:53 +05:30

36 lines
1.3 KiB
Markdown

---
title: Name resolution via `/etc/hosts`
menu_order: 50
search_type: Documentation
---
When starting Weave Net enabled containers, the proxy automatically
replaces the container's `/etc/hosts` file, and disables Docker's control
over it. The new file contains an entry for the container's hostname
and Weave Net IP address, as well as additional entries that have been
specified using the `--add-host` parameters.
This ensures that:
- name resolution of the container's hostname, for example, via `hostname -i`,
returns the Weave Net IP address. This is required for many cluster-aware
applications to work.
- unqualified names get resolved via DNS, for example typically via weaveDNS
to Weave Net IP addresses. This is required so that in a typical setup
one can simply "ping `<container-name>`", i.e. without having to
specify a `.weave.local` suffix.
If you prefer to keep `/etc/hosts` under Docker's control (for
example, because you need the hostname to resolve to the Docker-assigned
IP instead of the Weave IP, or you require name resolution for
Docker-managed networks), the proxy must be launched using the
`--no-rewrite-hosts` flag.
host1$ weave launch --no-rewrite-hosts
**See Also**
* [Using Automatic Discovery With the Weave Proxy]({{ '/tasks/weave-docker-api/automatic-discovery-proxy' | relative_url }})