TheTesla / dockerdns2etchosts

This program enables the host to contact the docker containers by their names.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Docker-DNS -> /etc/hosts

This program enables the host to contact the docker containers by their names.

How it works

This python3 script reads docker container ip addresses and names/aliases from /var/run/docker.sock and copies it to /etc/hosts on the host, where the docker containers are running.

It also deletes the entries from /etc/hosts if the corresponding container is down.

Installation

pip3 install -r requirements.txt

Run

sudo -E python3 manageetchosts.py 

Author

Stefan Helmert

About

This program enables the host to contact the docker containers by their names.


Languages

Language:Python 100.0%