Reputation: 191729
I've installed the Docker for Mac beta which allows you to use docker commands directly. I want to try to run rethinkdb
through docker, so I've followed the instructions of the rethinkdb docker container docs and done the following:
docker run --name some-rethink -v "$PWD:/data" -d rethinkdb
This works, and I can see the container with docker ps
and start shell with docker exec -it /bin/bash
However, I can't connect to the admin panel on my Mac directly with their suggestion
$BROWSER "http://$(docker inspect --format \
'{{ .NetworkSettings.IPAddress }}' some-rethink):8080"
This essentially amounts to google-chrome http://172.17.0.2:8080/
, but this doesn't work. I asked around and was told
You can't use the docker private ip address space to access the ports
You have to forward them to the mac
However, I'm not sure how to do this as I don't have any port forwarding tools I'm familiar with such as ssh
on the container itself. Using the suggested port forwarding command in the rethinkdb container docs ssh -fNTL ...
but with localhost
instead of remote
does not work.
How can I connect to the rethinkdb admin panel through http with the docker
beta on a Mac?
Upvotes: 2
Views: 764
Reputation: 2452
Try forwarding the container port using the -p
flag in the docker run
command, e.g.:
docker run -p 8080:8080 --name some-rethink -v "$PWD:/data" -d rethinkdb
and then it should be accessible on localhost,
google-chrome http://127.0.0.1:8080/
Relevant docker run
docs: https://docs.docker.com/engine/reference/run/#/expose-incoming-ports
Upvotes: 6