Docker on OS X with batteries included, aimed at making a more pleasant local development experience. Runs on top of docker-machine.
- Faster volume sharing using NFS rather than built-in virtualbox/vmware file shares. A medium-sized Rails app boots in 5 seconds, rather than 30 seconds using vmware file sharing, or 90 seconds using virtualbox file sharing.
- Filesystem events work on mounted volumes. Edit files on your host, and see guard/webpack/etc pick up the changes immediately.
- Easy access to running containers using built-in DNS and HTTP proxy.
Dinghy creates its own VM using
docker-machine, it will not modify your existing
Dinghy runs as a wrapper around
docker-machine, shelling out to create the VM
and using daemons to start the various services such as NFS and DNS.
TL;DR I am still actively maintaining Dinghy, making small improvements and fixing issues. But it's unlikely that there will be any large new development efforts unless somebody else wants to step up and take them on. Docker for Mac is a great option for most, if not all, people.
When we started the Dinghy project, Docker for Mac did not exist and there wasn't a great option for using Docker on MacOS easily with high-performance file sharing.
These days, Dinghy still has a performance advantage over Docker for Mac in some use cases where you are sharing lots of files from a host volume. But for the most part, you are fine just using Docker for Mac, you don't necessarily need Dinghy. There is a lot of discussion around the pros and cons in this issue.
Dinghy also includes a HTTP(S) proxy and DNS server that can make developing web apps easier, especially if you switch between projects frequently. This proxy can now be used without Dinghy on top of Docker for Mac, see the instructions in the dinghy-http-proxy README.
FAQ and solutions to common problems
Before filing an issue, see the FAQ.
upgrading from vagrant
If you previously used a version of Dinghy that ran on top of Vagrant, read this.
First the prerequisites:
- OS X Yosemite (10.10) or higher
- Docker and Docker Machine. These can either be installed with Homebrew (
brew install docker docker-machine), or using a package such as the Docker Toolbox.
- A Virtual Machine provider for Docker Machine. Currently supported options are:
$ brew tap codekitchen/dinghy $ brew install dinghy
You will need to install
docker-machine as well, either via Homebrew or the official Docker package downloads. To install with Homebrew:
$ brew install docker docker-machine
You can specify provider (
parallels), memory and CPU options when creating the VM. See available options:
$ dinghy help create
Then create the VM and start services with:
$ dinghy create --provider xhyve
Once the VM is up, you'll get instructions to add some Docker-related environment variables, so that your Docker client can contact the Docker server inside the VM. I'd suggest adding these to your .bashrc or equivalent.
$ docker run --rm hello-world
$ dinghy help Commands: dinghy create # create the docker-machine VM dinghy destroy # stop and delete all traces of the VM dinghy halt # stop the VM and services dinghy help [COMMAND] # Describe available commands or one specific command dinghy ip # get the VM's IP address dinghy restart # restart the VM and services dinghy shellinit # returns env variables to set, should be run like $(dinghy shellinit) dinghy ssh [args...] # ssh to the VM dinghy status # get VM and services status dinghy up # start the Docker VM and services dinghy upgrade # upgrade the boot2docker VM to the newest available dinghy version # display dinghy version
Dinghy installs a DNS server listening on the private interface, which
resolves *.docker to the Dinghy VM. For instance, if you have a running
container that exposes port 3000 to the host, and you like to call it
myrailsapp, you can connect to it at
myrailsapp.docker port 3000, e.g.
telnet myrailsapp.docker 3000.
You can also connect back to your host OS X machine from within a docker
container using the hostname
hostmachine.docker. This connects to the virtual
network interface, so any services running on the host machine that you want
reachable from docker will have to be listening on this interface.
Dinghy will run a HTTP proxy inside a docker container in the VM, giving you easy access to web apps running in other containers.
For docker-compose projects, hostnames will be automatically generated based on the project and service names. For instance, a "web" service in a "myapp" docker-compose project will be automatically made available at http://web.myapp.docker
Hostnames can also be manually defined, by setting the
environment variable on a container.
The proxy has basic SSL support as well.
See the dinghy-http-proxy documentation for more details on how to configure and use the proxy.
Advanced proxy configuration can be placed in a file at
HOME/.dinghy/proxy.conf. Details can be found in jwilder's nginx-proxy project.
Dinghy creates a preferences file under
HOME/.dinghy/preferences.yml, which can be used to override default options. This is an example of the default generated preferences:
:preferences: :proxy_disabled: false :fsevents_disabled: false :create: provider: virtualbox
If you want to override the Dinghy machine name (e.g. to change it to 'default' so it can work with Kitematic), it can be changed here. First, destroy your current dinghy VM and then add the following to your preferences.yml file:
:preferences: . . . :machine_name: default
Same goes for the default Dinghy dns resolver '*.docker' it can be changed to '*.dev' for example:
:preferences: . . . :dinghy_domain: dev
A note on NFS sharing
Dinghy shares your home directory (
/Users/<you>) over NFS, using a
private network interface between your host machine and the Dinghy
Docker Host. This sharing is done using a separate NFS daemon, not the
system NFS daemon.
Be aware that there isn't a lot of security around NFSv3 file shares. We've tried to lock things down as much as possible (this NFS daemon doesn't even listen on other interfaces, for example).
Custom NFS Mount Location
You can change the shared folder by setting the
DINGHY_GUEST_MOUNT_DIR environment variables before starting the dinghy VM. Usually you'll want to set both vars to the same value. For instance if you want to share
/code/projects over NFS rather than
/Users/<you>, in bash:
$ dinghy halt $ export DINGHY_HOST_MOUNT_DIR=/code/projects $ export DINGHY_GUEST_MOUNT_DIR=/code/projects $ dinghy up
There is an open issue for persisting this in the
~/.dinghy/preferences.yml file, and allowing multiple dirs to be exported: https://github.com/codekitchen/dinghy/issues/169
Custom certficate directory
You can change the default certificates directory
~/.dinghy/certs by setting the
DINGHY_CERT_PATH environment variable before starting the dinghy VM. This is useful if you have a custom NFS Mount location and your home directory is no more shared, in bash:
$ dinghy halt $ export DINGHY_CERT_PATH=/code/projects/certs $ dinghy up
If you didn't originally install Dinghy as a tap, you'll need to switch to the tap to pull in the latest release:
$ brew tap codekitchen/dinghy
To update Dinghy itself, run:
$ dinghy halt $ brew upgrade dinghy unfs3 $ dinghy up
To update the Docker VM, run:
$ dinghy upgrade
This will run
docker-machine upgrade and then restart the dinghy services.
You can install Dinghy's master branch with:
$ dinghy halt $ brew reinstall --HEAD dinghy $ dinghy up
This branch may be less stable, so this isn't recommended in general.