Forwarding a range of ports to QEMU #353

Closed
opened 2025-12-29 00:25:11 +01:00 by adam · 4 comments
Owner

Originally created by @talkingdonkeyz on GitHub (Apr 21, 2022).

I am trying to use Newtek's video streaming protocol NDI within the macOS image. NDI randomly assigns ports between 49152 and 65535 to transmit on, and there is no way to choose or preempt which port it uses. I've tried the quick and dirty method of adding those 16383 ports to my docker-compose file, but that causes docker to timeout and crash. Is there any way I can forward a range of ports to QEMU? Any help would be massively appreciated! Thanks in advance.

Here is my docker file...

FROM sickcodes/docker-osx as base
USER arch
COPY --chown=arch packages/images/compressed.img /home/arch/OSX-KVM/mac_hdd_ng.img
COPY --chown=arch packages/discovery-server/ndi-config.v1.json /home/arch/app/ndi-config.v1.json

FROM node:16 as build
WORKDIR /usr/app/
COPY package.json .
COPY yarn.lock .
COPY ./controller ./controller
COPY ./packages/types ./packages/types
COPY ./ingest ./ingest
WORKDIR /usr/app/ingest
RUN yarn install
RUN yarn build

FROM node:16 as install
WORKDIR /usr/app/
COPY ingest/package.json .
RUN yarn install --production=true
COPY --from=build /usr/app/ingest/dist ./dist

FROM base as release
COPY --chown=arch --from=install /usr/app /home/arch/app

...and here is my docker-compose file...

  ingest:
    image: ingest:latest
    privileged: true
    ports:
      - "50922:10022"
    environment:
      CORES: "16"
      RAM: "16"
      SMP: "16"
      GENERATE_SPECIFIC: "true"
      DEVICE_MODEL: "iMacPro1,1"
      SERIAL: "C02FKSYQHX87"
      BOARD_SERIAL: "C02115700CDJG36JA"
      UUID: "11016BF1-C22C-443A-B3A0-265891DB94C1"
      MAC_ADDRESS: "98:DD:60:95:DE:5A"
      NOPICKER: "true"
      EXTRA: "-virtfs local,path=/home/arch/app,mount_tag=hostshare,security_model=passthrough,id=hostshare -display none"
      MASTER_PLIST_URL: "https://raw.githubusercontent.com/sickcodes/Docker-OSX/master/custom/config-nopicker-custom.plist"
    devices:
      - "/dev/kvm"
Originally created by @talkingdonkeyz on GitHub (Apr 21, 2022). I am trying to use Newtek's video streaming protocol NDI within the macOS image. NDI randomly assigns ports between 49152 and 65535 to transmit on, and there is no way to choose or preempt which port it uses. I've tried the quick and dirty method of adding those 16383 ports to my docker-compose file, but that causes docker to timeout and crash. Is there any way I can forward a range of ports to QEMU? Any help would be massively appreciated! Thanks in advance. Here is my docker file... ``` FROM sickcodes/docker-osx as base USER arch COPY --chown=arch packages/images/compressed.img /home/arch/OSX-KVM/mac_hdd_ng.img COPY --chown=arch packages/discovery-server/ndi-config.v1.json /home/arch/app/ndi-config.v1.json FROM node:16 as build WORKDIR /usr/app/ COPY package.json . COPY yarn.lock . COPY ./controller ./controller COPY ./packages/types ./packages/types COPY ./ingest ./ingest WORKDIR /usr/app/ingest RUN yarn install RUN yarn build FROM node:16 as install WORKDIR /usr/app/ COPY ingest/package.json . RUN yarn install --production=true COPY --from=build /usr/app/ingest/dist ./dist FROM base as release COPY --chown=arch --from=install /usr/app /home/arch/app ``` ...and here is my docker-compose file... ``` ingest: image: ingest:latest privileged: true ports: - "50922:10022" environment: CORES: "16" RAM: "16" SMP: "16" GENERATE_SPECIFIC: "true" DEVICE_MODEL: "iMacPro1,1" SERIAL: "C02FKSYQHX87" BOARD_SERIAL: "C02115700CDJG36JA" UUID: "11016BF1-C22C-443A-B3A0-265891DB94C1" MAC_ADDRESS: "98:DD:60:95:DE:5A" NOPICKER: "true" EXTRA: "-virtfs local,path=/home/arch/app,mount_tag=hostshare,security_model=passthrough,id=hostshare -display none" MASTER_PLIST_URL: "https://raw.githubusercontent.com/sickcodes/Docker-OSX/master/custom/config-nopicker-custom.plist" devices: - "/dev/kvm" ```
adam closed this issue 2025-12-29 00:25:11 +01:00
Author
Owner

@sickcodes commented on GitHub (Apr 21, 2022):

Ports get forwarded in Launch.sh or using -e ADDITIONAL_PORTS

-e ADDITIONAL_PORTS='hostfwd=tcp::90-:90,hostfwd=tcp::443-:443,hostfwd=tcp::10023-:80,' \

@sickcodes commented on GitHub (Apr 21, 2022): Ports get forwarded in Launch.sh or using `-e ADDITIONAL_PORTS` ` -e ADDITIONAL_PORTS='hostfwd=tcp::90-:90,hostfwd=tcp::443-:443,hostfwd=tcp::10023-:80,' \`
Author
Owner

@talkingdonkeyz commented on GitHub (Apr 21, 2022):

Thanks, I'm getting closer. I think the issue is the number of ports that need to be forwarded. I wrote a script to generate the 16383 arguments and added them to the docker-compose file but running it resulted in. standard_init_linux.go:228: exec user process caused: argument list too long. Is there a way around this? I suppose what I'm looking for is something similar to docker expose where I would use EXPOSE 49152-65535 or a way to dynamically forward ports as needed.

I've looked into using OpenVPN to forward all of the ports into the docker-compose network over a single port. Along the lines of this post https://forums.debian.net/viewtopic.php?t=149522. But I'm hopeful there is a solution with less overhead.

@talkingdonkeyz commented on GitHub (Apr 21, 2022): Thanks, I'm getting closer. I think the issue is the number of ports that need to be forwarded. I wrote a script to generate the 16383 arguments and added them to the docker-compose file but running it resulted in. `standard_init_linux.go:228: exec user process caused: argument list too long`. Is there a way around this? I suppose what I'm looking for is something similar to docker expose where I would use `EXPOSE 49152-65535` or a way to dynamically forward ports as needed. I've looked into using OpenVPN to forward all of the ports into the docker-compose network over a single port. Along the lines of this post https://forums.debian.net/viewtopic.php?t=149522. But I'm hopeful there is a solution with less overhead.
Author
Owner

@talkingdonkeyz commented on GitHub (Apr 30, 2022):

I got this working using OVPN. This issue might be helpful for anyone else attempting to do something similar https://github.com/kylemanna/docker-openvpn/issues/475

@talkingdonkeyz commented on GitHub (Apr 30, 2022): I got this working using OVPN. This issue might be helpful for anyone else attempting to do something similar https://github.com/kylemanna/docker-openvpn/issues/475
Author
Owner

@sickcodes commented on GitHub (May 14, 2022):

Here's another cool way:

docker stop gluetun
docker rm gluetun
mkdir -p ~/gluetun
docker run -d --name gluetun --cap-add=NET_ADMIN \
    -e VPNSP="private internet access" -e REGION="${REGION}" \
    -e OPENVPN_USER=${PIA_USER} -e OPENVPN_PASSWORD=${PIA_PASS} \
    -v ~/gluetun:/gluetun \
    qmcgaw/gluetun

And then run docker --network gluetun ....

@sickcodes commented on GitHub (May 14, 2022): Here's another cool way: ``` docker stop gluetun docker rm gluetun mkdir -p ~/gluetun docker run -d --name gluetun --cap-add=NET_ADMIN \ -e VPNSP="private internet access" -e REGION="${REGION}" \ -e OPENVPN_USER=${PIA_USER} -e OPENVPN_PASSWORD=${PIA_PASS} \ -v ~/gluetun:/gluetun \ qmcgaw/gluetun ``` And then run `docker --network gluetun ....`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Docker-OSX#353