I am using an automated docker-image for php-fpm and nginx (https://hub.docker.com/r/tobi312/rpi-php/ and https://hub.docker.com/r/tobi312/rpi-nginx/ ) running on a raspberry pi with with libreelec on top.

The php container successfully starts with port 9000 open by running the following command:

docker run --name php -v /var/www/restTools:/var/www/html -d 3dd6ff8c0d58

After that I started the nginx-container like this:

docker run --name nginx -d -p 8081:80 --link php:9000 -v /var/www/restTools:/var/www/html 0d90cc6eb00f

Both containers are running but the nginx is not executing php files, it's just offering them for download.

After a while I tried to commit the connection details to the php-container trough a default.conf by adding -v /var/www/.config/nginx:/etc/nginx/conf.d:ro to the command.

Excerpt from default.conf:

root /var/www/html;

location / {
    root /var/www/html;
    index index.html index.htm index.php;

location ~ \.php$ {
    root /var/www/html;
    fastcgi_pass php:9000;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_index index.php;
    fastcgi_param REMOTE_ADDR $http_x_real_ip;
    fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
    include fastcgi_params;
    if (!-f $document_root$fastcgi_script_name) {
        return 404;

What am I missing?

1 Answer 1


You are trying to use the (deprecated!!) "link" option of docker, this is not a problem itself, but you have to respect the syntax

--link <name or id>:alias

so, you have to substitute your

--link php:9000

with the correct

--link php

you do not need an alias because you named the fpm container the same as you referred it in default.conf. The other important thing is to mount the php files folder in the fpm container but you already did this right.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.