shellhub icon indicating copy to clipboard operation
shellhub copied to clipboard

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

Open electr0nnn opened this issue 1 year ago • 3 comments

          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: - "${SHELLHUB_BIND_ADDRESS}:${SHELLHUB_HTTP_PORT}:80" mongo: volumes: - /usr/local/mongo/data:/data/db

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

electr0nnn avatar Apr 02 '24 04:04 electr0nnn

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

henrybarreto avatar Apr 17 '24 14:04 henrybarreto

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?

electr0nnn avatar Apr 30 '24 19:04 electr0nnn

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

henrybarreto avatar May 06 '24 14:05 henrybarreto