Giter VIP home page Giter VIP logo

docker-hosts-sync's Introduction

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.

Docker Hub Image »

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

Environment Default value Description
EXIT_RESET 1 Reset /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

Development

Building

$ cd /path/to/project/folder
$ go build -ldflags="-w -s"

Docker build

$ cd /path/to/project/folder
$ docker build .

Roadmap

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

Contributing

Feel free to fork the repository and submit pull requests.

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/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.