Opening extra port causes container to not load

Hello gang!

Hope everyone is doing well.

In my project i’m trying to open port 554 for rtsp to work with mjpg-streamer, however I noticed that opening up port 554 or any port for that matter beyond the initial one causes the container to loop constantly…

version: '2.4'
volumes:
  resin-data: {}
networks: {}
services:
  camera:
    tty: true
    build:
      context: .
      cache_from:
        - 'alpine:latest'
    ports:
      - '80:18080' <- works fine with this alone. 
      - '8080:8080' <- causes crash and loop. 
    labels:
      io.resin.features.dbus: '1'
      io.resin.features.firmware: '1'
      io.resin.features.balena-api: '1'
      io.resin.features.kernel-modules: '1'
      io.resin.features.supervisor-api: '1'
    cap_add:
      - ALL
    devices:
      - '/dev/mem:/dev/mem'
      - '/dev/video0:/dev/video0'
      - '/dev/vchiq:/dev/vchiq'
      - '/dev/vcsm-cma:/dev/vcsm-cma'
      - '/dev/i2c-0:/dev/i2c-0'
      - '/dev/i2c-1:/dev/i2c-1'
    restart: always
    volumes:
      - 'resin-data:/data'
    privileged: true
    environment:
      PORT: '18080'
    network_mode: bridge
  hostname:
    build:
      context: ./ident
    labels:
      io.balena.features.supervisor-api: '1'
    restart: 'no'
    environment:
      SET_HOSTNAME: $HOSTNAME

when i check the journal logs on the balena host i see

   Device state apply error Error: Failed to apply state transition steps. (HTTP code 400) unexpected - failed to create shim task: OCI runtime create failed: unable to retrieve OCI runtime error (open /var/run/balena-engine/containerd/daemon/io.containerd.runtime.v2.task/moby/1c8691fdb8211b3b76aab36fe78be0402cbefe9be8f476e3b946846c17795f12/log.json: no such file or directory): balena-engine-runc did not terminate successfully: exit status 2: runtime/cgo: pthread_create failed: Resource temporarily unavailable
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]     SIGABRT: abort
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   PC=0x7f93134944 m=5 sigcode=18446744073709551610
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   goroutine 0 [idle]:
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   runtime: unknown pc 0x7f93134944
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   stack: frame={sp:0x7f6ab0d020, fp:0x0} stack=[0x7f6a30db00,0x7f6ab0d700)
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0cf20:  0000000000401ed0  0000007f6ab0d148 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0cf30:  0000007f9335e6b0  000000000f11ed7d 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0cf40:  0000007f93364000  0000007f93365350 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0cf50:  0000000000000000  0000007f933656e8 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0cf60:  0000000000000001  0000007f930c86c8 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0cf70:  0000007f00000005  00000000930d9a50 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0cf80:  0000000000000006  0000007f9335e6b0 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0cf90:  00000000003c47b5  0000007f9335e648 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0cfa0:  0000007f93363b08  0000007f6ab0cfc8 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0cfb0:  0000007f6ab0cfc4  0000007f930c79c0 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0cfc0:  000000006ab0d020  0000000000000000 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0cfd0:  0000000000000005  0000000000000000 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0cfe0:  0000007f00000001  0000007f93365350 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0cff0:  0000007f6ab0d0f0  0000007f9333b0d8 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d000:  0000007f93365350  0000000000000540 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d010:  0000000002f8e1c0  0000000000000001 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d020: <0000007f6ab0d0e0  0000007f930fb458 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d030:  0000000000000006  0000007f9322b6d8 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d040:  0000007f6ab0e080  0000000000000001 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d050:  0000000000000000  0000007f933656e8 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d060:  0000000000000000  0000007f93365350 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d070:  0000000000000000  0000007f6ab0d0b8 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d080:  0000007f93364018  0000007f930c86c8 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d090:  0000000000000005  0000000093365350 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d0a0:  0000000000000006  00000000ffffffff 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d0b0:  00000000023fe6b0  0000007f930d4c38 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d0c0:  0000007f9335d5d0  0000007f6ab0d0e8 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d0d0:  0000007f6ab0d0e4  0000007f930c8078 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d0e0:  0000007f6ab0d100  0000007f930eaf64 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d0f0:  0000007f9322b000  0000007f930eaf18 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d100:  0000007f6ab0d250  00000000018b0454 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d110:  0000007f9322a618  0000000001b9d20c 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   runtime: unknown pc 0x7f93134944
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   stack: frame={sp:0x7f6ab0d020, fp:0x0} stack=[0x7f6a30db00,0x7f6ab0d700)
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0cf20:  0000000000401ed0  0000007f6ab0d148 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0cf30:  0000007f9335e6b0  000000000f11ed7d 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0cf40:  0000007f93364000  0000007f93365350 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0cf50:  0000000000000000  0000007f933656e8 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0cf60:  0000000000000001  0000007f930c86c8 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0cf70:  0000007f00000005  00000000930d9a50 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0cf80:  0000000000000006  0000007f9335e6b0 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0cf90:  00000000003c47b5  0000007f9335e648 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0cfa0:  0000007f93363b08  0000007f6ab0cfc8 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0cfb0:  0000007f6ab0cfc4  0000007f930c79c0 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0cfc0:  000000006ab0d020  0000000000000000 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0cfd0:  0000000000000005  0000000000000000 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0cfe0:  0000007f00000001  0000007f93365350 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0cff0:  0000007f6ab0d0f0  0000007f9333b0d8 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d000:  0000007f93365350  0000000000000540 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d010:  0000000002f8e1c0  0000000000000001 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d020: <0000007f6ab0d0e0  0000007f930fb458 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d030:  0000000000000006  0000007f9322b6d8 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d040:  0000007f6ab0e080  0000000000000001 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d050:  0000000000000000  0000007f933656e8 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d060:  0000000000000000  0000007f93365350 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d070:  0000000000000000  0000007f6ab0d0b8 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d080:  0000007f93364018  0000007f930c86c8 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d090:  0000000000000005  0000000093365350 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d0a0:  0000000000000006  00000000ffffffff 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d0b0:  00000000023fe6b0  0000007f930d4c38 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d0c0:  0000007f9335d5d0  0000007f6ab0d0e8 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d0d0:  0000007f6ab0d0e4  0000007f930c8078 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d0e0:  0000007f6ab0d100  0000007f930eaf64 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d0f0:  0000007f9322b000  0000007f930eaf18 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d100:  0000007f6ab0d250  00000000018b0454 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   0000007f6ab0d110:  0000007f9322a618  0000000001b9d20c 
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   goroutine 1 [chan receive, locked to thread]:
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   github.com/docker/docker/vendor/github.com/prometheus/client_golang/prometheus.(*Registry).Register(0x4000324f00, 0x2154468, 0x400048c2a8, 0x0, 0x0)
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]           /work/build/tmp/work/cortexa53-poky-linux/balena/20.10.40+gitb40c94d12ced74e3a72efbd21ba2ba736306c90a-r0/git/src/import/.gopath/src/github.com/docker/docker/vendor/github.com/prometheus/client_golang/prometheus/registry.go:288 +0x170
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   github.com/docker/docker/vendor/github.com/prometheus/client_golang/prometheus.(*Registry).MustRegister(0x4000324f00, 0x4000204f50, 0x1, 0x1)
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]           /work/build/tmp/work/cortexa53-poky-linux/balena/20.10.40+gitb40c94d12ced74e3a72efbd21ba2ba736306c90a-r0/git/src/import/.gopath/src/github.com/docker/docker/vendor/github.com/prometheus/client_golang/prometheus/registry.go:402 +0x74
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   github.com/docker/docker/vendor/github.com/prometheus/client_golang/prometheus.MustRegister(...)
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]           /work/build/tmp/work/cortexa53-poky-linux/balena/20.10.40+gitb40c94d12ced74e3a72efbd21ba2ba736306c90a-r0/git/src/import/.gopath/src/github.com/docker/docker/vendor/github.com/prometheus/client_golang/prometheus/registry.go:178
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   github.com/docker/docker/vendor/github.com/grpc-ecosystem/go-grpc-prometheus.init.0()
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]           /work/build/tmp/work/cortexa53-poky-linux/balena/20.10.40+gitb40c94d12ced74e3a72efbd21ba2ba736306c90a-r0/git/src/import/.gopath/src/github.com/docker/docker/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/client.go:26 +0x9c
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   goroutine 8 [runnable]:
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   github.com/docker/docker/vendor/github.com/prometheus/client_golang/prometheus.(*Registry).Register.func1(0x2154468, 0x400048c2a8, 0x400010ec60)
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]           /work/build/tmp/work/cortexa53-poky-linux/balena/20.10.40+gitb40c94d12ced74e3a72efbd21ba2ba736306c90a-r0/git/src/import/.gopath/src/github.com/docker/docker/vendor/github.com/prometheus/client_golang/prometheus/registry.go:276
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   created by github.com/docker/docker/vendor/github.com/prometheus/client_golang/prometheus.(*Registry).Register
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]           /work/build/tmp/work/cortexa53-poky-linux/balena/20.10.40+gitb40c94d12ced74e3a72efbd21ba2ba736306c90a-r0/git/src/import/.gopath/src/github.com/docker/docker/vendor/github.com/prometheus/client_golang/prometheus/registry.go:276 +0xfc
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   r0      0x0
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   r1      0x118d4
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   r2      0x6
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   r3      0x8
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   r4      0x20
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   r5      0x7f6ab0acb7
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   r6      0x656372756f736552
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   r7      0x61726f706d657420
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   r8      0x83
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   r9      0x7f931dffe8
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   r10     0x7f930c79c0
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   r11     0x7f6ab0cfc8
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   r12     0x7f6ab0cfc4
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   r13     0x656c62616c696176
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   r14     0x7f54000970
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   r15     0x0
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   r16     0x0
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   r17     0x0
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   r18     0x270f
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   r19     0x118d4
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   r20     0x6
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   r21     0x7f6ab0e080
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   r22     0x1
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   r23     0x0
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   r24     0x80e8c0
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   r25     0x7f6a2ff000
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   r26     0x7f6ab0d230
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   r27     0x0
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   r28     0x4000102180
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   r29     0x7f6ab0d020
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   lr      0x7f93134930
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   sp      0x7f6ab0d020
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   pc      0x7f93134944
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   fault   0x0
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]   : unknown  Steps:["start"]
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]       at fn (/usr/src/app/dist/app.js:10:9708)
Jan 29 12:49:54 camera1 ce1b45a0a539[36540]: [error]       at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

any ideas as to what might be happening here?

TYPE
Raspberry Pi Zero 2 W (64bit)")Raspberry Pi Zero 2 W (64bit)
HOST OS VERSION
[balenaOS 4.0.26+rev1]
OS VARIANT
development
SUPERVISOR VERSION
[
14.13.4
]

Dockerfile starts like:

ARG BALENA_ARCH=raspberrypi3
ARG TARGETPLATFORM
ARG VERSION
ARG TARGETARCH
FROM balenalib/$BALENA_ARCH-alpine:latest as build

Q: Should i be exposing the ports in the Dockerfile or docker-compose.yml? i exposed 18080 in both and had no issues when exposing a single port.

notes: i’m having to use raspberrypi3 image on the pizero2w. seems to be the only way i can get the camera to work.

any assistance would be greatly appreicated.
Kindly,
Puc

further troubleshooting:

{
  "api_port": 48484,
  "ip_address": "1xxxx 2a02:xxx",
  "os_version": "balenaOS 4.0.26+rev1",
  "mac_address": "D8:xxxx",
  "supervisor_version": "14.13.4",
  "update_pending": true,
  "update_failed": true,
  "update_downloaded": true,
  "status": "Installed",
  "download_progress": null
}

further furthar troubleshooting

root@camera1:~# balena ps -a 
CONTAINER ID   IMAGE                                                            COMMAND                  CREATED         STATUS                    PORTS                                                                                    NAMES
67e32d1c84f4   5c510dc235dd                                                     "/usr/bin/entry.sh /…"   3 minutes ago   Created                   0.0.0.0:50771->50771/udp, :::50771->50771/udp, 0.0.0.0:80->50770/tcp, :::80->50770/tcp   camera_8012822_2871400_0b33ba7441637f5b9580ab46c3f07c49
3fdae9e25980   92a171a22c01                                                     "/bin/sh /usr/src/st…"   2 hours ago     Exited (0) 2 hours ago                                                                                             hostname_8012823_2871400_0b33ba7441637f5b9580ab46c3f07c49
ce1b45a0a539   registry2.balena-cloud.com/v2/c21293be2bb5af01b28576c59c656ce7   "/usr/src/app/entry.…"   6 days ago      Up 14 minutes (healthy)                                                                                            balena_supervisor
root@camera1:~# balena logs 67e32d1c84f4
root@camera1:~# balena start 67e32d1c84f4
Error response from daemon: failed to create shim task: OCI runtime create failed: balena-engine-runc did not terminate successfully: exit status 134: runtime/cgo: pthread_create failed: Resource temporarily unavailable
: unknown
Error: failed to start containers: 67e32d1c84f4
root@camera1:~#