Pulling Docker Machine IP I am working with MongoDB through Docker, and I have a terrible bash command to pull the Docker Machine IP so I can sanely connect locally.

export dockerip="$(docker-machine ls | awk '{print $5}' | sed -n '2p' | sed 's/tcp:\/\///' | sed 's/\:2376//')"
mongo --host "$dockerip" --port 27017


How can I optimise the docker-machine line?
docker-machine provides a simple way to get the IP of the host machine

mongo --host `docker-machine ip default` --port 27017


I'm using default here, since that's the name of the machine I'm using.