-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Custom/parametrized port for fpm #479
Comments
Each FPM running in its own container will not have a port conflict with any other FPM running on the server. There are two ways to handle them. Run a load balancer like Nginx to proxy to the correct FPM container; this would access each FPM via its container IP at port 9000. This works great since you have to run something that speaks the FPM protocol in order to serve any web requests. This can easily be spread over multiple machines with Docker Swarm mode. This would also prevent any of the FPM ports from being potentially publicly accessible. Alternatively, with compose you can just map a different host port to the container port. Note that you would still need to run something like Nginx in order to route web requests to the FPM service. # this would make this FPM service available at port 9001 on the Docker host
ports:
- "9001:9000"
# or let Docker choose a high unused port like 32768 to use on the host
ports:
- "9000" |
Except if one wanted to use host networking, then there isn't any port mapping happening. I agree with @bsramin , it would be nice to be able to overwrite the 9000. |
If adjusting the default port is required, then as noted in #241, one should simply remove, replace, or adjust the configuration file in question. Something simple like the following should do the trick: FROM php:7.2-fpm
RUN sed -i 's/:9000/:3001/' /usr/local/etc/php-fpm.d/zz-docker.conf (which adjusts the port from 9000 to 3001 instead -- this could obviously be done via a custom |
Thanks. I had the same problem and your FROM php:7.2-fpm
RUN sed -i 's/9000/3001/' /usr/local/etc/php-fpm.d/zz-docker.conf There are no colons in the zz-docker.conf :) Cheers! |
Would not it be convenient to handle the fpm port (9000) in a custom way? So on compose or on run you can start it with the port we prefer. You would avoid conflicts with xdebug and you could start multiple fpm services on the same web server...
The text was updated successfully, but these errors were encountered: