DOCKER:ERR_EMPTY_RESPONSE - Mac

I'm new to Docker and just made my first steps. I wanted to play a little bit with docker and was about configuring a Dockerfile for yii:

FROM php:7.2.3-apache

RUN curl -sS https://getcomposer.org/installer | php && \
    mv composer.phar /usr/local/bin/composer

RUN apt-get update && apt-get install -y git unzip zip

EXPOSE 8080

RUN composer create-project --prefer-dist yiisoft/yii2-app-basic test

Then I run the container with:

docker container run -d --name test -p 8080:8080 test-yii

When I go to localhost:8080 i got an ERR_EMPTY_RESPONSE. This is the network result of docker container inspect:

"Ports": {
     "80/tcp": null,
     "8080/tcp": [
          {
               "HostIp": "0.0.0.0",
               "HostPort": "8080"
          }
     ]
},

I appreciate every hint that helps me to solve this issue!

Edit: I forgot to mention that i connect to the container and then run php yii serve to test if Yii runs and this results in the above described problem.

YII is not started when you create a container. That's because it isn't defined in Dockerfile. Only apache starts there, because that's come from the image php:7.2.3-apache.

The correct Dockerfile is:

FROM php:7.2.3-apache

RUN curl -sS https://getcomposer.org/installer | php && \
    mv composer.phar /usr/local/bin/composer

RUN apt-get update && apt-get install -y git unzip zip

EXPOSE 8080

RUN composer create-project --prefer-dist yiisoft/yii2-app-basic test
CMD test/yii serve 0.0.0.0 

Now, CMD layer with yii overlaps CMD layer from php:7.2.3-apache image.

If you want to start both yii and apache inside a container you should look to these pieces of advice.

Update to the Edit section in the question:

You need to run php yii serve 0.0.0.0. Otherwise yii binds to localhost:8080 and is only accessible inside a container