docker-hat
A hat for your Docker!
This is a set of helper commands to run and manage Docker containers on OS X.
Requirements
- Homebrew
- VirtualBox
- Node.js (>= 0.12)
- Automatically installed if installing via Homebrew!
Installation
Super simple with Homebrew, just run the below and you'll be up-and-running in no time:
brew tap chinthakagodawita/homebrew-dh
brew update
brew install docker-hat
Commands
All commands are simply sub-commands of the dh
binary. A full list is below (examples coming soon!):
dh init
Sets up Docker to run on your Mac. This goes off and sets up (via dinghy) the following things:
- Docker host VM (boot2docker): To run your containers in,
docker-machine
is used to instrument this - NFS server (unfsd): So that files can be shared to the container without being bottlenecked by VirtualBox's shared folder implementation
- DNS nameserver (dnsdock): Creates a wildcard DNS on
*.docker
which automatically maps to the Docker host
Usage
dh init
dh soe
Starts up a nifty Standard Operating Environment for building various applications in. Currently only supports PHP (with special focus on Drupal & Wordpress) but more coming soon!
See the docker-containers repository for a full list and Dockerfiles.
Subcommands
dh soe start
Start up a new container using one of the special pre-built SOE images.
Usage
dh soe start <container-name>
dh soe stop
Stop an already-running container.
Usage
dh soe stop <container-name>
dh soe restart
Restart a running container using the same settings it was started up with.
Usage
dh soe restart <container-name>
dh soe drush
Run Drush inside on of your running containers. Sets up paths correctly so that it executes on your docroot.
Usage
dh soe drush <container-name> [command]
dh host
Controls your Docker host virtual machine and environment.
You shouldn't normally need to start or stop this manually—it should be brought up when required. This command is there for all the times it refuses to listen.
Subcommands
dh host start
Start the Docker host virtual machine.
Usage
dh host start
dh host stop
Stop the host.
Usage
dh host stop
dh host restart
Restart the host.
Usage
dh host restart
dh host status
Show Docker host status.
Usage
dh host status
dh exec
Run a command (any command!) in a container.
Usage
dh exec <container-name> <command>
Example
dh exec foo tail -f /var/log/apache2/error.log
dh shell
Attaches a bash shell to one of your containers and gives your full interactive control. Simply type exit
to close.
Usage
dh shell <container-name>
Example
dh shell foo