Docker Community Forums

Share and learn in the Docker community.

New in Docker. Need to write a Dockerfile according to requirements


#1

How to write the docker file for the given requirements

  1. Use Ubuntu 16.04 as base image
  2. Container should have NginX 1.14.x and PHP 7.x
  3. Create a file named index.html with some dummy content
  4. Add this file at this working directory: /opt/projects
  5. Make this file accessible at http://127.0.0.1:8080
  6. Make the information about PHP’s configuration (<?php phpinfo(); ?>) accessible at
  7. http://127.0.0.1:8080/info.php
  8. NginX should write necessary access and error logs
  9. Mount NginX’s access and error log at host’s /var/log/nginx

(Rubendario) #2

I haven’t worked with PHP, but i made it in Python and Gunicorn, and you should try read how to make it, dont put in forums all your work. I hope it helps you.

FROM ubuntu:16.04

RUN mkdir -p /opt/projects

WORKDIR /opt/projects

RUN sudo apt install nginx && sudo apt install php7.0

COPY . /usr/src/app

ENTRYPOINT ["gunicorn"]
CMD ["-w", "2", "-b", ":8080", "app:app"]