Docker Community Forums

Share and learn in the Docker community.

Docker: invalid publish opts format (should be name=value but got

Hello,

I’m new to docker, and trying to learn the most of it.

I’m trying to deploy up to 4 Containers of the same application (FreeSWITCH in my case…OpenSource PBX/Switch for Telephony).

I was able to deploy the first one, and it’s working properly, this is the command i ran:

docker run --net=host --name freeswitch -p 8880:22 -p 5060:5060/tcp -p 5060:5060/udp -p 5080:5080/tcp -p 5080:5080/udp -p 8021:8021/tcp -p 7443:7443/tcp -p 60535-65535:60535-65535/udp /bin/bash -e SOUND_RATES=8000:16000 -e SOUND_TYPES=music:en-us-callie -v freeswitch-sounds:/usr/share/freeswitch/sounds -v /etc/freeswitch/:/etc/freeswitch safarov/freeswitch

And container is running accordingly:

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
bc601cd72345 safarov/freeswitch “/entrypoint.sh /bin…” 6 hours ago Up 5 minutes (healthy) freeswitch_pbx_1

When trying to run the second one i need, i’m getting an error, here’s my command and the output i get:

dadiaspe@srv-lx-containers-fs-01:~$ docker run --net=host --name freeswitch_pbx_2 -p 8881:22 -p 5061:5061/tcp -p 5061:5061/udp -p 5081:5081/tcp -p 5082:5082/udp -p 8022:8022/tcp -p 7444:7444/tcp -p 65536-70000:65536-70000/udp /bin/bash -e SOUND_RATES=8000:16000 -e SOUND_TYPES=music:en-us-callie -v freeswitch-sounds:/usr/share/freeswitch/sounds -v /etc/freeswitch_pbx_2/:/etc/freeswitch safarov/freeswitch
docker: invalid publish opts format (should be name=value but got ‘8881:22’).
See ‘docker run --help’.

What exactly could be wrong here? i changed the port mapping for this new container, so it’s not the same as previous one, but still getting this error. Any ideas on this please?

Thanks so much

Hi Community,

Any ideas on this one please? It’s driving me nuts :confused:

If actually what you want to do is run 4 replicas of the same application then I would suggest you take a look at docker swarm. In addition to being able to scale up and down easily, you only need one set of ports that your caller applications need to know as well as gaining resilience thru automatic self healing. I’m not a great fan of exposing ports in this way or binding to the host network stack, but without knowing more about why you have done that it’s hard to know whether it’s a good idea or not.