user1804599
user1804599

Reputation:

Custom application directory in PHP-FPM container

I'm using the php:7-fpm Docker image but I cannot put my application in /var/www/html. Instead, I want to put it in /opt/foo. /opt/foo is a volume. How can I do this without replacing the whole PHP-FPM configuration?

Upvotes: 1

Views: 4664

Answers (1)

user1804599
user1804599

Reputation:

PHP-FPM defaults to the working directory, but because the image sets the working directory before it sets the command, you can't customize it with WORKDIR. So the only way to do it neatly seems to be appending to the PHP-FPM configuration file:

RUN echo 'chdir = /opt/foo' >> /usr/local/etc/php-fpm.d/www.conf

Upvotes: 1

Related Questions