how to run a simple local docker container for janus?

2,391 views
Skip to first unread message

august black

unread,
Feb 10, 2022, 6:09:23 PM2/10/22
to meetecho-janus
Hi,

What's the best way to run a simple docker container for janus?

Does one need to set up a special docker network to get it to function?

Is there a one-liner 'docker run' command that will work for localhost using "host" networking (specifically so that I can reverse proxy from local nginx to janus on 127.0.0.1) ?

Thanks for any help.

-August.

Lorenzo Miniero

unread,
Feb 11, 2022, 3:17:28 AM2/11/22
to meetecho-janus
Alessandro made a presentation on that at JanusCon: https://www.januscon.it/2019/talk.php?t=docker

L.

august black

unread,
Feb 12, 2022, 7:34:21 PM2/12/22
to Lorenzo Miniero, meetecho-janus
Thanks everyone for the help/tips!

I got  a few private mentions that I will pass along here for the record:


Lorenzo, I had already Allessandro's talk and _thought_ I needed a local docker network.

I think I was overthinking it.

I have a basic bare-bones janus Dockerfile  that builds the version I want and then runs Janus with:

CMD /usr/local/bin/janus  -r 9000-9500 -F /opt/janus/conf

I can simply start the container locally with:

docker run -v `pwd`/conf:/opt/janus/conf   -p 8188:8188   august/janus-alpine

What I don't understand about the networking, however, is that I can make the WebRTC udp connections despite not specifying port mapping to docker container.

I was under the assumption I would have to map 9000-9500, but that doesn't seem to be the case.



--
You received this message because you are subscribed to the Google Groups "meetecho-janus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to meetecho-janu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/meetecho-janus/b7bd0311-631f-4d37-9c19-ffc34ede5039n%40googlegroups.com.

Lorenzo Miniero

unread,
Feb 13, 2022, 4:38:25 AM2/13/22
to meetecho-janus
Alessandro's talk explains why not mapping ports can lead to issues, and why host networking is preferred. If you don't, things might still work, and yet the often won't: I'm sure you'd prefer something that works all the time ;-)

L.

august black

unread,
Feb 13, 2022, 7:49:20 AM2/13/22
to Lorenzo Miniero, meetecho-janus

Thanks Lorenzo (and Alesandro for posting the talk slides)

For now, I am just looking for an easy solution for local development in a small academic team (with mixed OS's).

Do you think using the simple docker bridge network would be okay for that?  Each dev would be communicating from their local browser to local docker janus.

Otherwise, Alesandro's talk doesn't go into implementation details about creating a docker network to run janus in host mode.

Would I just create the docker network and then run janus in the docker container with `nat-1-1=<DOCKER_IP>` ?

...

Here are some other things I don't understand and would love a bit of help on, if someone had the time.

When I start janus inside the docker with bridge networking, I alway see:  [WARN] Janus is deployed on a private address (172.17.0.2) but you didn't specify any STUN server!

The 'private address' can change  though, sometimes it is 192.168.65.3.  Is that just the internal docker IP address?


Why does bridge networking work with janus, but "host" networking with the following doesn't? :   docker run -v `pwd`/conf:/opt/janus/conf   --network host  august/janus-alpine
I would expect host networking to just use the local host network and all ports would be exposed.  However, running the above, I cannot connect to janus websocket at  localhost:8188 .

thanks for any help you might have, best -August.





august black

unread,
Feb 14, 2022, 11:52:37 AM2/14/22
to Lorenzo Miniero, meetecho-janus

I think I found my answer.  "host" networking only works where linux is the host.

"The host networking driver only works on Linux hosts, and is not supported on Docker Desktop for Mac, Docker Desktop for Windows, or Docker EE for Windows Server."

It seems, however, that running docker in "host" networking mode on Mac/Win doesn't give you an error.  It just fails to work silently.

I'll need to stick to "bridge" networking for local development.  It seems to be working for the most part

Reply all
Reply to author
Forward
0 new messages