Skip to content

bug: Docker Container Network Configuration Issue - Alternative to network_mode: host #18377

Closed
@cleicastro

Description

@cleicastro

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Problem Description

I'm currently running Coder in a Docker container using network_mode: "host" which works perfectly, but I need to avoid using host networking mode for security and isolation reasons. When I remove the host network mode, the container doesn't function properly.

Current Working Configuration

version: '3.8'
services:
  coder:
    image: ghcr.io/coder/coder:latest
    container_name: coder
    network_mode: "host"  # This works but I want to avoid it
    volumes:
      - coder_data:/home/coder
      - /var/run/docker.sock:/var/run/docker.sock
    restart: unless-stopped

volumes:
  coder_data:

What I've Tried

I attempted to replace network_mode: "host" with explicit port mapping:

ports:
  - "7080:7080"
environment:
  - CODER_HTTP_ADDRESS=0.0.0.0:7080

However, this doesn't provide the same functionality as the host network mode.

Expected Behavior

I expect Coder to work with standard Docker networking (bridge mode) using explicit port mappings, providing the same functionality as network_mode: "host" but with better container isolation.

Additional Context

From the coder ping output, I can see the service is running on port 7080, but I suspect there might be additional networking requirements for workspace communication or other Coder features.

Any guidance on the proper network configuration would be greatly appreciated!

Relevant Log Output

coder ping -n 5 test

Image

Expected Behavior

No response

Steps to Reproduce

  1. What is the recommended Docker Compose configuration for Coder without using network_mode: "host"?
  2. Are there specific ports or network requirements that need to be configured?
  3. Do I need additional environment variables for proper network configuration?
  4. How should I handle dynamic port allocation for workspaces in this setup?

Environment

  • Coder Version: Latest (from ghcr.io/coder/coder:latest)
  • Docker Compose Version: 3.8
  • Host OS: proxmox
  • Network Setup: Private network with WireGuard VPN

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triageIssue that require triage

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions