jarylc/docker-hosts-sync

By jarylc

Updated about 2 years ago

Lightweight Docker image to synchronize Docker host's /etc/hosts file with Docker

Image
Networking
Developer tools
Web servers
0

10K+

jarylc/docker-hosts-sync repository overview

Docker Hosts Sync Logo

Docker Hosts Sync

Lightweight Docker image to synchronize Docker host's /etc/hosts file with Docker on container start and destruction.

Explore the docs »

Report Bugs · Request Features

About The Project

This application makes possible to communicate via network with Docker containers via their container names on the Docker host. It's like as though you were communicating with another container within one!

Features
  • Super lightweight, final docker image based on scratch!
  • Updates only on container start and destruction, doesn't waste resources by checking periodically (i.e. every 5 seconds).
  • EXIT_RESET flag to set if changes to /etc/hosts should be reset on exit.
Environment Variables
EnvironmentDefault valueDescription
EXIT_RESET1Reset /etc/hosts on exit
Built With

Getting Started

To get a local copy up and running follow these simple steps.

Docker Run
docker run -d \
  --name docker-hosts-sync \
  --privileged \
  -e EXIT_RESET=1 \
  -v /var/run/docker.sock:/var/run/docker.sock:ro \
  -v /etc/hosts:/etc/hosts \
  --restart unless-stopped \
  jarylc/docker-hosts-sync
Docker-compose
docker-hosts-sync:
    image: jarylc/docker-hosts-sync
    privileged: true
    environment:
      - EXIT_RESET=1
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /etc/hosts:/etc/hosts
    restart: unless-stopped

Roadmap

See the open issues for a list of proposed features (and known issues).

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Jaryl Chng - [email protected]

https://jarylchng.com

Project Link: https://gitlab.com/jarylc/docker-hosts-sync/

Tag summary

Content type

Image

Digest

sha256:e230a2fb8

Size

2.5 MB

Last updated

about 2 years ago

Requires Docker Desktop 4.37.1 or later.