shellhub-io / shellhub

:computer: Get seamless remote access to any Linux device. Centralized SSH for the edge and cloud computing
https://shellhub.io
Apache License 2.0
1.36k stars 135 forks source link

Port already Allocated/services.gateway.ports array must be unique #3675

Open electr0nnn opened 5 months ago

electr0nnn commented 5 months ago
          Now I am getting 

validating /root/git/shellhub/docker-compose.override.yml: services.gateway.ports array items[0,1] must be unique make: *** [Makefile:43: start] Error 15

I have this as my .env.override & docker-compose.override.yml

docker-compose.override.yml version: '3.7' services: gateway: ports:

When I change :80 to :8042 it sort of works but says the port is already allocated which is false because I haven't even used it yet, same if I make it different from SHELLHUB_HTTP_PORT.

.env.override SHELLHUB_SSH_PORT=2242 SHELLHUB_HTTP_PORT=8042 SHELLHUB_HTTPS_PORT=4442 SHELLHUB_BIND_ADDRESS=127.0.0.1

Originally posted by @electr0nnn in https://github.com/shellhub-io/shellhub/issues/3478#issuecomment-2031053130

henrybarreto commented 5 months ago

Hello, @electr0nnn

Thank you for your patience; we have been working on a lot of new and thrilling features these days.

Looking at your issue, I notice that Docker Compose default behavior for multi-value options ports, expose, external_links, dns, dns_search, and tmpfs, Compose concatenates both sets of values instead of override, what caused the problem of port already allocated.

Replicating what you mentioned, the .env.override and docker-compose.override.yml, this is the result of ./bin/docker-compose config.

 gateway:
    ...
    ports:
      - mode: ingress
        host_ip: 127.0.0.1
        target: 80
        published: "8042"
        protocol: tcp
      - mode: ingress
        host_ip: 127.0.0.1
        target: 8042
        published: "8042"
        protocol: tcp
electr0nnn commented 4 months ago

Sorry. this might be a stupid question, but what is it I do then? I am not quite sure I understand, is it due to Docker limitations or because it was going off of the default files and not the .override?

henrybarreto commented 4 months ago

To understand better your use case and help you, could, please, explain why are doing this port redirect?