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:

  • What is equivalent remote api command to 'docker run -d'?
  • SkyDNS does not work with Kubernetes 1.1.2
  • Load balancing express app instances
  • Docker compose - share volume Nginx
  • kubernetes unhealthy ingress backend
  • change timezone under docker image based on tinycore
  • \code
        index.html
    site.conf
    docker-compose.yml
    

    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:

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

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

    php-docker.local    127.0.0.1
    

    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?

  • How to bind publish port in Dockerfile on AWS Beanstalk
  • Docker can not run on Windows 10 linux child system
  • executing mysql script docker
  • Cannot start container: process is killed
  • Docker container mounting a database from another container
  • could not read Username for 'https://github.com': No such device or address
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.