Add an Entry to the Hosts File in Astro CLI (Local)

If you’re running the Astronomer CLI and need to add an entry to the hosts file, follow the steps below.

Customize your Docker Compose Override File

  1. Create a docker-compose.override.yml file in your Airflow project directory.
  2. Use the following template to add your hosts:
    version: "2"
          - "test-server:"
          - "different-server:"
          - "test-server:"
          - "different-server:"

Make sure to specify version: "2" and mimic the format of the source code file linked above.

Confirm that Hosts were Added

If you bash into your Scheduler or Webserver container locally and view the contents of your /etc/hosts file, you should then see the hosts you added correctly render.

  1. Run $ docker ps
  2. Copy the CONTAINER ID of either your Scheduler or Webserver Container.
  3. Run $ docker exec -it <CONTAINER-ID> bash
  4. Run $ cat /etc/hosts
  5. See:   localhost
    ::1         localhost ip6-localhost ip6-loopback
    fe00::0     ip6-localnet
    ff00::0     ip6-mcastprefix
    ff02::1     ip6-allnodes
    ff02::2     ip6-allrouters   different-server   test-server d5c8441ece31
1 Like