Search code examples
macoscontainersdockerboot2docker

Cannot get boot2docker port forwarding to work on docker mac os X


Here is what I have tried:

My goal: running the prosody XMPP server inside a container, accessed by my (as-yet uncontainerized) local development environment.

I installed the prosody XMPP server - this is what I am trying to use as a container for local development.

It comes dockerized here:

https://github.com/lloydwatkin/prosody-docker

I ran, as per documentation:

docker run -d prosody/prosody --name prosody -p 5222:5222

I checked prosody was running with docker exec -t -i /bin/bash

docker ps shows that the container is running, forward to 5222.

But, on my Mac local shell, telnetting to my boot2docker ip on port 5222 cannot connect.

I have tried this https://github.com/boot2docker/boot2docker/blob/master/doc/WORKAROUNDS.md

but I cannot get that to work.

To add to my confusion, the latest docker.com documentation states port forwarding should work, under Container Port Redirection:

https://docs.docker.com/installation/mac/


Solution

  • There was an error in the docker container documentation for prosody. The correct order of params are:

    docker run -d --name prosody -p 5222:5222 prosody/prosody

    There's no error handling so it was really difficult to identity.