-
Notifications
You must be signed in to change notification settings - Fork 2k
Expose a different port in Apache image? #94
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
Comments
Making that change will break things for all existing users of this image. The security situation for Apache dropping privileges from |
@md5 You can run a container and Even if you want to keep compatibility, how about the php-fpm image? This image also runs a root process but it never exposes a privileged port. |
@xuhdev Indeed. It's also true that if you use |
@xuhdev You might also be interested in this discussion around the In that case, |
Also a related issue in Docker moby/moby#8460 |
Seeing as the latest best practice from Docker (https://www.youtube.com/watch?v=LmUw2H6JgJo) is to not use a restricted port: Here is what I've done locally #190 It does require users to add the -p 80:8080 or -p 443:8443 but seems like the shortest path to get the container updated. Documentation would look like deekthesqueak/docs@be93e6c |
IMO it's worth pointing out that Docker now supports using user namespaces to remap your container For further configuration modification of this variety, I think our best (most maintainable) solution is going to be to have users provide custom configuration for custom requirements. |
At the startup, you can always do stuff like
Something like that will work : |
Given both the solutions in this thread, and the solution in moby/moby#8460 (comment), I believe this is now a non-issue, and as such I'm going to close. I have personally used $ docker run -it --rm --user 1000:1000 --sysctl net.ipv4.ip_unprivileged_port_start=0 --tmpfs /run:uid=1000 php:7.2-apache
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.19. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.19. Set the 'ServerName' directive globally to suppress this message
[Fri Dec 22 21:00:37.781952 2017] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.25 (Debian) PHP/7.2.0 configured -- resuming normal operations
[Fri Dec 22 21:00:37.781974 2017] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND' |
Restricted ports isn't the only reason to want this. For example, running in Google Cloud Run requires that you listen on a port specified in an environment variable; you don't get to choose your own port. The sed idea isn't going to pass anyone's code review - it's far too likely to break mysteriously on an update. |
It isn't really necessary to use 80 as we can publish the port to any host port. Using port 80 however makes apache start as root, which is a security downgrade. How about changing it to 8080?
The text was updated successfully, but these errors were encountered: