npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

docker-machine-dns

v1.2.3

Published

Runs a tiny DNS server that resolves *.docker hostnames using docker-machine ip

Downloads

32

Readme

docker-machine DNS server

This package fires up a tiny (~100 lines) DNS server whose sole purpose is to listen for *.docker DNS lookups and resolve the hostname using docker-machine ip.

How it works:

  • DNS query for dev.docker comes in
  • Server parses out "dev.docker"
  • Server responds with the result of $(docker-machine ip dev)

Environment variables

DOCKER_MACHINE_DNS_RESOLVER

Change the default IP resolver from docker-machine ip to your own custom command by setting this environment variable.

DOCKER_MACHINE_DNS_TLD

Change the default tld from docker by setting this environment variable.

Setup:

Install in the usual way:

npm install -g docker-machine-dns

Setup: The easy way

Run this:

sudo mkdir -p /etc/resolver
sudo touch /etc/resolver/docker
sudo chown -R $USER /etc/resolver		

This creates the /etc/resolver directory (if it doesn't already exist) and grants ownership to your current user account. The service will automatically configure the resolver/docker file on each run, making it "just work".

Setup: The way that doesn't require changing ownership of /etc/resolver

Write this to /etc/resolver/docker and always run with the same specified port

nameserver	127.0.0.1
port	12345
search_order	300000
timeout	1

Note: the whitespace separators in this file NEED to be tabs. Spaces won't work.

Example:

$ docker-machine ls
NAME   ACTIVE   DRIVER       STATE     URL                         SWARM
dev             virtualbox   Running   tcp://192.168.99.100:2376
dev2            virtualbox   Running   tcp://192.168.99.101:2376
dev3            virtualbox   Stopped

$ ping -t 4 dev.docker
ping: cannot resolve dev.docker: Unknown host

$ docker-machine-dns &
[1] 18007
Listening on UDP port 55451

$ ping -t 4 dev.docker
PING dev.docker (192.168.99.100): 56 data bytes
64 bytes from 192.168.99.100: icmp_seq=0 ttl=64 time=0.268 ms
64 bytes from 192.168.99.100: icmp_seq=1 ttl=64 time=0.272 ms
64 bytes from 192.168.99.100: icmp_seq=2 ttl=64 time=0.313 ms
64 bytes from 192.168.99.100: icmp_seq=3 ttl=64 time=0.454 ms

--- dev.docker ping statistics ---
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.268/0.327/0.454/0.076 ms

$ ping -t 4 dev2.docker
PING dev2.docker (192.168.99.101): 56 data bytes
64 bytes from 192.168.99.101: icmp_seq=0 ttl=64 time=0.232 ms
64 bytes from 192.168.99.101: icmp_seq=1 ttl=64 time=0.394 ms
64 bytes from 192.168.99.101: icmp_seq=2 ttl=64 time=0.284 ms
64 bytes from 192.168.99.101: icmp_seq=3 ttl=64 time=0.222 ms

--- dev2.docker ping statistics ---
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.222/0.283/0.394/0.068 ms

docker-machine-dns can take a UDP port as its first (and only) argument to bind to that specific port instead of randomly picking one on each run.