There is such a Dockerfile :
FROM zercle/docker-ubuntu # Update OS RUN apt update && apt -y full-upgrade # Install PHP RUN apt-add-repository -y ppa:ondrej/php \ && apt update \ && apt -y install \ php-ssh2 \ php7.1-cli \ php7.1-curl \ php7.1-fpm \ php7.1-gd \ php7.1-gmp \ php7.1-imap \ php7.1-json \ php7.1-ldap \ php7.1-mbstring \ php7.1-mcrypt \ php7.1-mysql \ php7.1-opcache \ php7.1-pgsql \ php7.1-readline \ php7.1-snmp\ php7.1-soap \ php7.1-sqlite3 \ php7.1-xml \ php7.1-xmlrpc \ php7.1-xsl \ php7.1-zip \ php-memcached \ php-mysqlnd-ms \ php-imagick RUN apt-get install -y nginx RUN systemctl enable php7.1-fpm.service RUN service nginx start RUN service php7.1-fpm start # Clean file RUN apt-get autoclean EXPOSE 9000 #ENTRYPOINT ["/etc/init.d/nginx", "restart", ";", "/etc/init.d/php7.1-fpm", "restart"] #CMD /etc/init.d/php7.1-fpm restart && /etc/init.d/nginx restart #CMD service php7.1-fpm start CMD /etc/init.d/nginx restart #CMD ["/etc/init.d/nginx", "restart", "&&", "/etc/init.d/php7.1-fpm", "restart"] So the point is that nginx & php-fpm does not start when $ docker-compose up -d .
Everything is working, because if you run nginx & php-fpm from under the container, everything works fine.
The next question is - how can I “automatically” raise the necessary services inside the docker-container?