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:

  • Does putting ARG at top of Dockerfile prevent layer re-use?
  • Save data generated from a Python app running in Docker swarms in Mysql Database
  • Intermittent Connection Errors for Docker Swarm Services
  • AWS Elastic Beanstalk Application and Static Assets Deployment Isolation
  • Docker image from existing Rails/Unicorn/MySQL app
  • Make docker container run forever while being able to gracefully stop
  • FROM php:5.6-apache
    COPY  ./ /var/www/html/
    WORKDIR /usr/src/service
    CMD [ "php", "./requestdispatcher.php" ]

  • dotnet core on docker performance
  • netcat for MySQL connection forwarding
  • Windows: Using Tensorflow with Python 3 instead of Python 2 (Docker)
  • Using Docker to mimic an existing Production server vs. deploying Docker containers to production?
  • docker windows exposed ports cannot be accessed from outside the host
  • Connecting to ElasticSearch plugin under proxy settings
  • One Solution collect form web for “Dockerfile for PHP service”


    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.