coolify icon indicating copy to clipboard operation
coolify copied to clipboard

[Feature]: option for using the host network

Open otahirs opened this issue 1 year ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Summary

Add option to bind the container directly to the host network. equal to the docker run --network host ...

ps: this option would bypass the coolify proxy, it is expected there is a custom reverse proxy setup (e.g. nginx) or that the port is meant to be directly exposed to the internet

Why should this be worked on?

In network heavy application the docker bridge network can become the main performance bottleneck.

otahirs avatar Jun 04 '23 20:06 otahirs

Having the same issue here - was there any fix?

maxexcloo avatar Jun 01 '24 04:06 maxexcloo

With the default installation and using caddy, the internal web apps only see the docker bridge address. I was able to get it working for the web apps by adding network_mode: host and removing the network block because they are not compatible together In the proxy server config:

version: '3.8'
services:
  caddy:
    container_name: coolify-proxy
    image: 'lucaslorentz/caddy-docker-proxy:2.8-alpine'
    restart: unless-stopped
    network_mode: host
    extra_hosts:
      - 'host.docker.internal:host-gateway'
    environment:
      - CADDY_DOCKER_POLLING_INTERVAL=5s
      - CADDY_DOCKER_CADDYFILE_PATH=/dynamic/Caddyfile
    networks:
      - coolify
    ports:
      - '80:80'
      - '443:443'
    volumes:
      - '/var/run/docker.sock:/var/run/docker.sock:ro'
      - '/data/coolify/proxy/caddy/dynamic:/dynamic'
      - '/data/coolify/proxy/caddy/config:/config'
      - '/data/coolify/proxy/caddy/data:/data'

Now my web apps can see the real IP but this breaks access to the main coolify app itself (still have it on port 8000). Why is that so?

{
  "level": "error",
  "ts": 1717660262.7968147,
  "logger": "http.log.error",
  "msg": "dial tcp: lookup coolify-realtime on 127.0.0.53:53: server misbehaving",
  "request": {
     ...,
  }
  "duration": 0.001383811,
  "status": 502,
  "err_id": "ie0vnxi7e",
  "err_trace": "reverseproxy.statusError (reverseproxy.go:1267)"
}

For having this on non http apps, would be ideal to support --network host here https://coolify.io/docs/knowledge-base/docker/custom-commands

matheusfillipe avatar Jun 24 '24 19:06 matheusfillipe

I second this, I tried to spin up a CoTurn Docker server, and they do state that Host network is recommended as Docker does not handle many ports well like this 3478:3478,3478:3478/udp,5349:5349,5349:5349/udp,49152-65535:49152-65535/udp and this killed the whole server completely!

So this feature would be amazing 🙂

itniels avatar Jul 12 '24 22:07 itniels