For local development, most of the time you need some sort of 3rd party services like Postgres, Redis, Elasticsearch, etc. Installing them to your local machine using Homebrew is okay at the beginning, but imagine how troublesome it is after running brew upgrade
, or you have another project which depends on a version that differs from what you have installed. Running them in docker containers is a much better solution.
Stocker is a tool for helping you to bootstrap the docker-compose.yml
set up, which you can use for booting up the services in containers.
Vagrant is a great tool for setting up isolated development environment, but using VirtualBox is just too slow and resources intensive. Using docker for that should be more lightweight, especially with the release of Native Docker on Mac and Windows which uses the native virtualization of the OS.
curl -L https://github.com/pinglamb/stocker/releases/download/0.1/stocker-`uname -s`-`uname -m` > /usr/local/bin/stocker
P.S. It currently works on Mac only.
Inside your project, you can run:
stocker add postgres
It will add postgres
to your docker-compose.yml
, it will also map the ports
the service exposes to your host machine. You might need to update your configuration file for that.
This is another helper for managing your running dockers. When you have multiple projects and they are all using docker containers for external dependencies, it might be troublesome to find those containers that occupies the ports your current project needs. With the following command:
stocker up
It will find the containers which are using the ports you need and stop them for you. Hassle-Free ~
Feel Free.
MIT