How to add extra hosts to docker containers

If you need to add extra hosts to any of the docker services, you can do that by adding them in the docker-compose.override.yml file, which is located in /home/fleio/compose.

The following syntax should be used:

version: "3.7"
services:
  backend:
    extra_hosts:
      - "example1:10.10.10.2"
      - "example2:10.10.10.3"
  celery:
    extra_hosts:
      - "example1:10.10.10.2"
      - "example2:10.10.10.3"
  celerybeat:
    extra_hosts:
      - "example1:10.10.10.2"
      - "example5:10.10.10.3"
  operations:
    extra_hosts:
      - "example1:10.10.10.2"
      - "example2:10.10.10.3"
  updated:
    extra_hosts:
      - "example1:10.10.10.2"
      - "example6:10.10.10.6"
  incomingmail:
    extra_hosts:
      - "example1:10.10.10.2"
  utils:
    extra_hosts:
      - "example1:10.10.10.2"

The utils container is used for commands like fleio bash or fleio shell. You might need extra hosts for debugging commands like ping or telnet.

Finally, you need to run fleio recreate in order to apply the changes. Note that all Fleio containers will be re-created, so any manual change inside docker containers will be lost.