Dockerfile for PHP service

I need to create a Dockerfile for my php service. I just tried many options found in web, and none work correctly. I have simple PHP project in /home/karol/docker-file/service/start.php. Really important for me. Thanks in advance.

Currently looking like this:

  • How to persist Docker data in HOST
  • Pecl doesn't work in php:7.0-fpm image
  • Docker run does not deploy
  • How to dynamically set environment variables of linked containers?
  • Getting an “operation not supported” error when trying to RUN something while building a docker image
  • Bluemix containers - how have a Linux
  • FROM php:5.6-apache
    COPY  ./ /var/www/html/
    WORKDIR /usr/src/service
    CMD [ "php", "./requestdispatcher.php" ]
    

  • Forward host port to docker container
  • docker add cache when git checkout same file
  • How does Docker share resources
  • How to place files on shared volume from within Dockerfile?
  • Kitematic + MariaDB + SequelPro
  • Using MySQL with Spring boot docker image
  • One Solution collect form web for “Dockerfile for PHP service”

    Reference: https://hub.docker.com/_/php/

    DockerFile
    
    FROM php:5.6-cli
    COPY  /home/karol/docker-file/service /usr/src/service
    WORKDIR /usr/src/service
    CMD [ "php", "./start.php" ]
    

    Build docker image

    docker build -t imagename .

    Run container

    docker run -it –rm –name conatainername imagename

    When running as a service

    FROM php:5.6-apache
    COPY  /home/karol/docker-file/service /var/www/html/
    

    Build Image

    docker build -t imagename .

    Run Container

    docker run -d -p 8080:80 –name conatainername imagename

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.