DEV Community

shroomlife 🍄
shroomlife 🍄

Posted on

docker-https-proxy to proxy your docker containers

Hey,

as a developer I use docker on my servers and sometimes I want to have multiple containers running on one server and they should be reachable through different hostnames. As this proxy feature is my only requirement I don't want to use Apache or Nginx bloated services. They have a lot of features but they are not needed for just a splitting purpose.

So I created a little neat docker image that can easily be used as a main proxy container to proxy requests among hostnames accross your containers.

Also I wanted to have HTTPs working for my proxy so I added a self-signed certificate that can easily be used behind a Cloudflare account. You can also add your own certificate if want to. The whole thing is #opensource!

GitHub: https://github.com/shroomlife/docker-https-proxy
Docker Hub: https://hub.docker.com/r/shroomlife/docker-https-proxy

easy setup with docker-compose

version: '3.3'
services:
  proxy:
    container_name: proxy
    image: shroomlife/docker-https-proxy:latest
    ports:
      - "80:80"
      - "443:443"
  example.com:
    container_name: example.com.proxy
    image: httpd:latest

Just add .proxy to your example.com domain and you are ready to go!

There you can also find a helpful README for setting it up for your own needs. I hope I can help other developers solve a common problem with ease.

Would love to hear some feedback from the community!

Best,
shroomlie

Discussion (0)