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:
1$ dock redis jenkins sonar 2 3Starting redis (using /Users/ben/.dock-formulas/formulas/redis) 4Container started 5Name: redis 6IP: 192.168.59.103 7Ports: 6379 8 9Starting jenkins (using /Users/ben/.dock-formulas/formulas/jenkins) 10Container started 11Name: jenkins 12IP: 192.168.59.103 13Ports: 8472 14 15Starting sonar (using /Users/ben/.dock-formulas/formulas/sonar) 16Container started 17Name: sonar-mysql 18IP: 192.168.59.103 19Ports: 3306 20Container started 21Name: sonar-server 22IP: 192.168.59.103 23Ports: 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 .
1# as an OS X user with Homebrew 2brew tap bripkens/dock 3brew install dock 4 5 6# for other platforms (assuming ~/bin is on your $PATH) 7curl https://raw.githubusercontent.com/bripkens/dock/master/dock -so ~/bin/dock && \ 8 chmod +x ~/bin/dock && \ 9 dock -u && \ 10 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.
More articles
fromBen Ripkens
Your job at codecentric?
Jobs
Agile Developer und Consultant (w/d/m)
Alle Standorte
More articles in this subject area
Discover exciting further topics and let the codecentric world inspire you.
Gemeinsam bessere Projekte umsetzen.
Wir helfen deinem Unternehmen.
Du stehst vor einer großen IT-Herausforderung? Wir sorgen für eine maßgeschneiderte Unterstützung. Informiere dich jetzt.
Hilf uns, noch besser zu werden.
Wir sind immer auf der Suche nach neuen Talenten. Auch für dich ist die passende Stelle dabei.
Blog author
Ben Ripkens
Do you still have questions? Just send me a message.
Do you still have questions? Just send me a message.