Docker Compose .yml file not allowing website to dependancy on reverse proxy

I’m working to get four website running in separate containers by building them all in one compose file. I’ve got the nginx reverse proxy to work properly but when it comes to launching the website that depends on the proxy is get the following error:

The Compose file ‘./docker-compose.yml’ is invalid because:
networks.website value Additional properties are not allowed (‘depends_on’, ‘image’, ‘ports’, ‘volumes’, ‘container_name’ were unexpected)

Now I’ve gone through the compose file and deleted spaces, googled some reference sites and nothing seemed to work. could anyone tell me what going on. Should I run them separately. my compose file is below:

version: ‘2’
services:
reverse-proxy:
image: jwilder/nginx-proxy
container_name: nginx-proxy
volumes:

  • /var/run/docker.sock:/tmp/docker.sock:ro
    ports:
  • 80:80

networks:
default:
external:
name: nginx-proxy

website:
image: httpd
container_name: website1
volumes:

  • /var/run/docker.sock:/tmp/docker.sock:ro
    ports:
  • 80:80

networks:
default:
external:
name: nginx-proxy

website:
image: httpd
container_name: website1
volumes:

  • ./Dockfolder/website1/:/usr/local/apache2/htdocs/
    ports:
  • 8086:80
    depends_on:
  • reverse-proxy

My system is Ubuntu (linux) with docker version 18.03.0-ce , and compose version 3. upgrade from 2 and still received the same error.

I believe I solved it by adding the website to the network that the proxy is in. Also I’m looking to add this to a swarm with three other webpages if anyone have any suggestion feel free to share.

Thanks.