Proxy Community
What's the best way to set up a Docker proxy service for secure container traffic? Alternatively: How - Printable Version

+- Proxy Community (https://proxycommunity.com/forum)
+-- Forum: Proxy Tools (https://proxycommunity.com/forum/forum-proxy-tools)
+--- Forum: Software (https://proxycommunity.com/forum/forum-software)
+--- Thread: What's the best way to set up a Docker proxy service for secure container traffic? Alternatively: How (/thread-what-s-the-best-way-to-set-up-a-docker-proxy-service-for-secure-container-traffic-alternatively-how)

Pages: 1 2


What's the best way to set up a Docker proxy service for secure container traffic? Alternatively: How - CipherDrift99 - 12-04-2024

Subject: What's the best way to set up a docker proxy service for secure container traffic?

Hey folks,

I’ve been tinkering with Docker lately and keep hearing about using a docker proxy service to manage container traffic securely. But tbh, I’m a bit lost on the best approach.

Should I go with something like Nginx or Traefik? Or is there a simpler way to set this up without overcomplicating things?

Also, is a docker proxy service *really* necessary for small setups, or is it more for larger, multi-container environments? Would love to hear how y’all handle this.

Thanks in advance!

(PS: If anyone’s got a quick config example, that’d be awesome 👀)


“” - WebShroudX - 20-10-2024

Hey! For a simple docker proxy service setup, I’d recommend Traefik. It’s way easier to configure than Nginx for Docker environments, especially if you’re using labels.

Here’s a quick example for a `docker-compose.yml`:
```yaml
services:
traefik:
image: traefik:v2.5
command: --api.insecure=true --providers.docker
ports:
- "80:80"
- "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
```
Traefik auto-discovers containers, so you don’t need to manually update configs. For small setups, it’s overkill, but if you’re scaling, it’s a lifesaver.


“” - VeilWalker99 - 15-11-2024

Nginx is solid, but yeah, it’s a bit more manual. If you’re just starting, maybe try Caddy? It’s like Nginx but with automatic HTTPS. Super simple for a docker proxy service.

For small projects, you might not even need a proxy—just expose ports directly. But if you’re paranoid about security (like me), a proxy adds a nice layer.

Check out Caddy’s docs: https://caddyserver.com/docs/quick-starts/docker


“” - maskedFly77 - 28-12-2024

Honestly, unless you’re running multiple containers or need SSL, skip the docker proxy service. Docker’s built-in networking is fine for small stuff.

But if you *do* need it, Traefik is the way to go. Nginx works, but it’s like using a sledgehammer for a nail. Overkill unless you’re doing something fancy.


“” - SecretPass99 - 31-12-2024

I’ve used both Nginx and Traefik, and Traefik wins for Docker setups. The auto-config is *chef’s kiss*.

For security, you’ll want to pair it with Let’s Encrypt. Here’s a snippet for HTTPS:
```yaml
command:
- --entrypoints.web.address=:80
- --entrypoints.websecure.address=:443
- --certificatesresolvers.myresolver.acme.httpchallenge=true
- --certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web
```
Docs: https://doc.traefik.io/traefik/


“” - deepNomad99 - 10-03-2025

If you’re lazy (like me), just use Cloudflare Tunnel. No need to mess with a docker proxy service—it handles SSL and routing for you.

It’s free for small stuff, and you don’t even need to expose ports. Just run the container, point it to Cloudflare, and boom. Done.

https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/


“” - CipherDrift99 - 27-03-2025

OP here—wow, thanks for all the replies! Traefik seems to be the crowd favorite, so I’ll give that a shot. The auto-discovery sounds like a game-changer.

Quick follow-up: Anyone got tips for debugging Traefik if it’s not picking up containers? I’ll probably mess something up lol.

(And thanks for the Caddy/Cloudflare suggestions too—might try those for another project!)


“” - ShadowMancer99 - 03-04-2025

For a *super* minimal docker proxy service, check out `jwilder/nginx-proxy`. It’s an auto-configuring Nginx container. Super easy:

```bash
docker run -d -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock:ro jwilder/nginx-proxy
```
Then any container with `VIRTUAL_HOST=example.com` gets routed. No fuss.

But yeah, Traefik is better long-term.