Docker Community Forums

Share and learn in the Docker community.

How can I access docker container on MAC from other PC

(Wangzhiliang) #1

I hava a docker on my MAC.So I want my other colleagues access my docker, what can i do for this?
I can access docker on my mac, ip is but the other one cann’t access.

(Carlos E. Salazar) #2

It would help to know how you created your container and how you want it to be accessed (via shell, browser…), but basically you want to expose the port(s).

Important: these steps this might re-create your container (I’m not 100% sure) and you would lose its content. Be sure to have a volume attached or to save the content somewhere before trying this.

From Kitematic: Select your container on the left side, then Settings > Ports and add/modify the ports if needed.

If you want to do this from the command line, with a new container, you would use -p <host_port>:<container_port>. Example:
docker run -p 8080:80 -d nginx

Then, if your colleagues are on the same network and your container has an http server, they could browse your host IP:port. I.E.:

If you’re trying to expose the container outside of your network, you could use something like ngrok.

Google “docker expose ports” for more information.