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:

  • Docker container to local osx postgres
  • How to deal with temporary apt-key adv failures?
  • Why is the Docker vfs storage backend not considered suitable for production?
  • Sporadic 503s from specified ports
  • How does one remove an image in Docker?
  • Store persistent data in docker container directory
  • FROM php:5.6-apache
    COPY  ./ /var/www/html/
    WORKDIR /usr/src/service
    CMD [ "php", "./requestdispatcher.php" ]
    

  • Is there an alternative/workaround for `boot2docker save`?
  • How to reach additional containers by the hostname after docker-compose scale?
  • Docker Error when Starting an Image
  • Akka 2.5 Distributed Data on Docker + Alpine Linux
  • Access tomcat running in docker container by JMX
  • How to run Karma tests from docker container?
  • 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.