mirror of
https://github.com/dutchcoders/transfer.sh.git
synced 2026-02-06 07:22:17 +00:00
The LISTENER environment variable isn't working with Docker. #112
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @flavorgold1 on GitHub.
It's stuck on port 8080.
How do I change this?
@stefanbenten commented on GitHub:
We could make it so that the binary per default listens on 8080 without specifying the flag at all, right?
Then setting the env variable should help, or one needs to pass this flag to the run command. Certainly better than having to maintain custom script solutions.
@paolafrancesca commented on GitHub:
I was aware of the hardcoded listener value before in the
Dockerfileand not so happy about it but I didn't want to remove since it could break a lot of docker deploymentNot sure if this is supported in docker, but could be a solution:
ENTRYPOINT ["/go/bin/transfersh", "--listener", "${LISTENER:-8080}"]I've spent some time testing, it is not supported
the workaround will be to do something like:
ENTRYPOINT ["/go/bin/transfersh", "--listener", "${DOCKER_LISTENER:-8080}"]and we have to replace this:
https://github.com/dutchcoders/transfer.sh/blob/main/server/server.go#L96
with
srvr.ListenerString = os.ExpandEnv(s)the problem is that
os.ExpandEnv()doesn't support as well the env notation used in the entrypointso we would have to write our own env expansion function, I'm not sure we want to go down that road: I tried a sample one calling
echoon the shell, but we have noechosince the image is based on scratch@flavorgold1 commented on GitHub:
I understand that but, I'm in a situation where I have to use
network_mode: hostindocker-compose.yml. So, if there's a way through which it can respect thatenvironment variable, it'd be great. Thanks anyways.@stefanbenten commented on GitHub:
@aspacca I would like your opinion on this.
@stefanbenten commented on GitHub:
Hello @flavorgold1,
the port is fixed inside of the container, see here:
b30b296ac8/Dockerfile (L38)In order to map it to a different port you should probably use the docker networking features like this:
docker run -p 8081:8080 dutchcoders/transfer.sh:latest@paolafrancesca commented on GitHub:
these two changes fixes, only cons: users not specifing a
--listenerflag/LISTENERenv variable will now bind on every interface instead of localhost onlyif we keep
Value: "127.0.0.1:8080", docker won't bind on every interface but only localhost, that's more disruptive probably@paolafrancesca commented on GitHub:
doh @flavorgold1
I did't think about the most obvious solution: overriding the
entrypoint(either on docker-compose or with--entrypointon docker run)having
/go/bin/transfershas entrypoint should be enough if you specify aLISTENERenv variable@flavorgold1 commented on GitHub:
This may be a crude solution, but, here's my
docker-compose.ymlfile. It is located in/home/username/transfersh_docker, along with adatadirectory located in that same directory. It works:@paolafrancesca commented on GitHub:
I will close this since it's solved
@flavorgold1 commented on GitHub:
The way it is right now, it allows me to access the service via IPv4 and IPv6 directly, with
network_mode: host. That's a good thing. Please preserve that functionality.