blacklabelops-legacy / nginx

Dockerized Ready-To-Go Nginx Reverse Proxy. Let's encrypt Support!
MIT License
95 stars 41 forks source link

Autodiscovery for Docker Containers #23

Open blacklabelops opened 7 years ago

blacklabelops commented 7 years ago

Question: Would autodiscovery in this image greatly improve your work? Please give feedback!

Scenario:

  1. Rather than enumerate env variables on the nginx container attach those environment variables on an arbitrary amount of containers.
  2. Attach the docker socket to the nginx container
  3. Entrypoint will read a list of containers and look for those environment variables.
  4. All containers with those environment variables will be included in the configuration.

Enhancement:

Example:

Starting application Jira:

docker run -d --name jira \
    --network jiranet \
      -e "JIRA_DATABASE_URL=postgresql://jira@postgres/jiradb" \
      -e "JIRA_DB_PASSWORD=jellyfish"  \
      -e "NGINX_REVERSE_PROXY_LOCATION1=/" \
      -e "NGINX_REVERSE_PROXY_PASS1=http://jira:8080" \
      blacklabelops/jira

Starting nginx:

docker run -d \
    -p 80:80 \
    -v /var/run/docker.sock:/var/run/docker.sock \
    --name nginx \
    --network jiranet \
    blacklabelops/nginx
eOperationsPN commented 7 years ago

Yes, absolutely! As jwilders nginx reverse proxy! Would love to see this feature

MrHash commented 7 years ago

I think it could be useful although I would suggest a 3.x branch as I imagine there to be a fair amount of complexity, such as handling multiple server definitions from a container, push/pull reload strategies, configuration validation, load balancing support etc. while also maintaining BC.