I've started running app services on docker so I don't have to deal with installing shit all the time.
However that means each time you start up a service it comes up on a different random port unless you deliberately map one. But dynamic ports are easier so provided you give the containers for each service a name then they are inspectable using the docker commands.
docker-machine ip default
gives you the ip address of the default docker host.
docker port name-of-container
will list all mapped ports from internal port number to host port number
3306/tcp -> 0.0.0.0:32769
docker inspect --format="{formatstr}" name-of-container
will let you pick elements out of the Go formatted data structure
docker inspect --format="{{(index (index .NetworkSettings.Ports \"3306/tcp\") 0).HostPort}}" name-of-mysql
That's a bit unwieldy so I made a docker-service
script that will give you the ip, port or ip:port for a container-name and standard port number eg.
$ docker-service odc-mysql 3306 ip
192.168.99.100
$ docker-service odc-mysql 3306 port
32769
$ docker-service odc-mysql 3306 addr
192.168.99.100:32769
dotenv lets you run commands when setting variables by using $(cmd)
and all .yml files in rails let you embed ERB so you can use ruby backticks to execute shell commands there and get the output.