Unable to dockerize nginx and index.html page

I try to follow this tutorial. So, these are my prerequisites:

  1. ubuntu version is 16.04.1 LTS
  2. docker version is 1.12.6
  3. docker-compose version 1.9.0

My local directory looks like so:

  • How can I run docker python tests without pre-loading all local machines?
  • apt-get not working in Dockerfile
  • 502 http error from nginx+letsencrypt proxy on docker
  • Why does Docker say it can't execute 'bash"?
  • How would one specify which containers to start and not to start in docker-compose? (docker run vs docker create)
  • Share docker images between hosts with NFS
  • \code

    The index.html contents is just “Hello world”.

    The site.conf contents:

    server {
        index index.html;
        server_name php-docker.local;
        error_log  /var/log/nginx/error.log;
        access_log /var/log/nginx/access.log;
        root /code;

    The docker-compose.yml contents:

      image: nginx:latest
      - "8080:80"
      - ./code:/code
      - ./site.conf:/etc/nginx/conf.d/site.conf

    And finally in my /etc/hosts file I added to the top this line:


    With all that, when I run this command:

    docker-compose up --force-recreate

    And go to php-docker.local:8080, I get “Server not found” error. If however I go to localhost:8080 I see a standard welcoming nginx page. So, what is wrong with that and how can I fix it? Or what can I do to debug it?

  • Git clone repo in Dockerfile
  • boot2docker is autoupgrading
  • Debian : Using a cron task on Docker
  • ERROR: compose.cli.main.main: 500 Internal Server Error: Cannot start container : [9] System error: not a directory
  • can't connect to docker container from outside
  • Strategy for versioning Docker images linked to other contains via docker compose
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.