Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
electr0nnn opened this issue Apr 2, 2024 · 3 comments
Open
Labels
question Further information is requested

Comments

@electr0nnn
Copy link

          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 #3478 (comment)

@henrybarreto
Copy link
Member

henrybarreto commented Apr 17, 2024

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 henrybarreto added the question Further information is requested label Apr 22, 2024
@electr0nnn
Copy link
Author

electr0nnn commented Apr 30, 2024

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
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants