Overview

Docker simplified: Run Redis, MongoDB and more with a few keystrokes

No Comments

You probably know this situation: To develop a piece of software, other services like databases and messaging systems are required. These services would traditionally be installed natively on developers’ machines or would be running inside virtual machines. While these strategies work, the latest movement around Docker has proven that interesting alternatives exist. With Docker and a small tool called dock you can start all necessary services for your development environment in seconds.

Don’t know Docker? No problem! You don’t really need to know Docker to use dock. Just make sure that you have Docker installed. For more details about Docker check out the blog post of my colleague Lukas Pustina.

Introducing dock

Suppose you need to have MongoDB running locally to develop a quick prototype. With dock it is super easy to run such services. Just type dock mongodb and you are done! Or how about starting Redis with dock redis? dock makes developers happier by making it easy and fast to start isolated services. You can even start more complex setups as the following listing shows:

$ dock redis jenkins sonar
 
Starting redis (using /Users/ben/.dock-formulas/formulas/redis)
Container started
Name:       redis
IP:         192.168.59.103
Ports:      6379
 
Starting jenkins (using /Users/ben/.dock-formulas/formulas/jenkins)
Container started
Name:       jenkins
IP:         192.168.59.103
Ports:      8472
 
Starting sonar (using /Users/ben/.dock-formulas/formulas/sonar)
Container started
Name:       sonar-mysql
IP:         192.168.59.103
Ports:      3306
Container started
Name:       sonar-server
IP:         192.168.59.103
Ports:      8474

Under the hood dock uses Docker. Docker is great in itself and it becomes even more versatile with dock. dock adds a formula mechanism which is targeted at developers’ needs for local development environments. Without this formula mechanism you would need to know how to start containers, which images to use and what ports should be published. By having a dedicated formula for each service the developer only needs to know the name of the service. Formulas are maintained on GitHub and can be extended by other developers through pull requests. If your services are not covered already, please send a pull request or open an issue.

dock even supports you when you need to move beyond the provided formulas. You can run dock with the --cat argument to instruct it to print formulas’ details. The details contain the Docker commands that would normally be executed by dock. Use the details to learn more about Docker or to get a starting point for your advanced setup.

Installation

dock is being developed on GitHub as a shell script. Installation is as simple as downloading the script and putting it on your $PATH. OS X users can install and upgrade dock via Homebrew. Of course you will also need Docker.

# as an OS X user with Homebrew
brew tap bripkens/dock
brew install dock
 
 
# for other platforms (assuming ~/bin is on your $PATH)
curl https://raw.githubusercontent.com/bripkens/dock/master/dock -so ~/bin/dock && \
     chmod +x ~/bin/dock && \
     dock -u && \
     echo "dock installation successful. Try running 'dock'"

Conclusion

Docker has a lot of potential and dock makes it even easier to use. dock shines when prototyping or learning new tools, but can also be used on a day to day basis. The list of supported services is currently pretty short, but is easy to extend. Let me know about any services that you may need or help me out with a pull request.

Comment

Your email address will not be published. Required fields are marked *