Giter VIP home page Giter VIP logo

dockness's Introduction

dockness Build Status

DNS for Docker machines, allows to access them with the following domain format : {machine}.docker.

How it works

It spins up a simplistic DNS server, only listening for questions about A records.

Behind the scene it will use libmachine in order to resolve IP addresses.

Installation

Prebuilt binaries

Prebuilt binaries are available in the releases.

From source (requires Go)

go get github.com/bamarni/dockness

With Homebrew (Mac OS X)

brew tap mkw/homebrew-mkw
brew install dockness

Usage

dockness [options...]

Options:
  -tld    Top-level domain to use (defaults to "docker")
  -ttl    Time to Live for DNS records (defaults to 0)
  -port   Port to listen on (defaults to "53")
  -debug  Enable debugging (defaults to false)

Mac OSX

To develop on Mac you probably have a local VM, using VirtualBox for example. However this machine gets assigned a dynamic IP address.

You can be up and running in a few commands, first :

> echo -e "nameserver 127.0.0.1\nport 10053" | sudo tee /etc/resolver/docker

It tells your Mac that the resolver for .docker TLD listens locally on port 10053. You can now run the resolver on this port :

> dockness -port 10053
2016/02/18 10:39:52 Listening on :10053...

Linux

Even though Linux users might not need a development VM, it can be useful for remote machines (eg. ssh staging2.docker, ...).

Here and unlike Mac OSX, there is no quick trick to make it work out of the box. Linux distributions come with more advanced DNS management where manually tweaking resolv.conf is usually not an option.

What should work in most cases is to use Dnsmasq, which provides a lightweight DNS server.

If you have it installed, you can run :

> dockness -port 10053
2016/02/18 10:40:43 Listening on :10053...

Then let Dnsmasq know about the resolver by running those commands :

> echo "server=/docker/127.0.0.1#10053" | sudo tee -a /etc/dnsmasq.conf
> sudo /etc/init.d/dnsmasq restart

Configure dockness as a service

As it's not very convenient to run the program manually in a terminal, you can instead set it as a service. Doing so, it will be running in the background automatically when booting your computer.

Mac OSX

You can create the appropriate service configuration file at ~/Library/LaunchAgents/local.dockness.plist :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Disabled</key>
        <false/>
        <key>Label</key>
        <string>local.dockness</string>
        <key>ProgramArguments</key>
        <array>
                <string>/path/to/dockness</string>
                <string>-port</string>
                <string>10053</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
</dict>
</plist>

Finally, the service can be enabled :

launchctl load ~/Library/LaunchAgents/local.dockness.plist

Linux

Here again, it will depend on your Linux distribution. We'll take as example Systemd, which is nowadays the default init system in most distributions.

Create the following file at /etc/systemd/system/dockness.service:

[Unit]
Description=Dockness
After=network.target

[Service]
ExecStart=/path/to/dockness -port 10053

[Install]
WantedBy=multi-user.target

dockness's People

Contributors

bamarni avatar zored avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dockness's Issues

Automate release

New releases could be created through the github API. Maybe there are existing tools for this.

memory leak

As dns records are served, memory usage keeps on growing. I suspect this to happen since the switch to libmachine (d36d821).

Aliases for machines

Hi! Your tool is awesome. ๐Ÿ‘

I have a machine with multiple hostnames. Could I add some additional aliases for them?

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.