v2fly / docker

docker build repo for v2fly
https://hub.docker.com/r/v2fly/v2fly-core
MIT License
724 stars 208 forks source link

Allow container to run as non root #62

Closed raidenii closed 1 year ago

raidenii commented 1 year ago

Hi,

Please allow the container to run as non root user. The current Dockerfile WORKDIR /root prevents even --user arg when running the container as non root. Changing it to WORKDIR /tmp still builds the image successfully. Happy to submit a PR for that (and also remove dependency on openssl - for verifying the digest file, alpine image comes with sha512sum).

Also, is there a particular reason that this container need to run as root? By default, to bind port > 1024, any process can do, and /dev/shm is open for all for domain sockets. Even when the container needs to bind at port 443 on host, it can still be done via docker-proxy to redirect the port binding, and use high ports inside the container.

kslr commented 1 year ago

In most cases, tls etc, external port 443 is must required

raidenii commented 1 year ago

OK - my point still stands.

This PR simply allows one to run the container using --user argument, by which one can specify a non-root user to run it (e.g., nobody). If not specified, the container still runs as root inside and out, which allows it to bind to port 443.

Also, as I pointed out, one can run the container as nobody, and in config file binding the port to say, 10086, but use something like -p 443:10086 to map it to 443 on host.