Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about docker-with-docker-network #14

Open
kefniark opened this issue Nov 18, 2023 · 0 comments
Open

Question about docker-with-docker-network #14

kefniark opened this issue Nov 18, 2023 · 0 comments

Comments

@kefniark
Copy link

Description

Hi there,

Recently I'm using docker-network-mode-host template on multiple workspace. And it worked well until I start to have few conflict between projects.

Putting each workspace in a private network looked like a great idea to avoid any problem
So I started to take a look at the other dind template docker-with-docker-network

But I couldn't make it work like described:

  • The Readme.md and the main.tf don't seem to agree, the readme show some code that differ in the actual code
  • Using the main.tf file seem to work at first, the provision and starting works fine. But the networking is so private everything happening inside can't open port or forward port to the outside. Making it pointless for most workspaces

So I'm kinda stuck not able to expose port from inside this application at the host level

Details

The main issue seem to be around the readme:

resource "docker_container" "dind" {
  image      = "docker:dind"
  privileged = true
  network_mode = "host"
  name       = "dind-${data.coder_workspace.me.id}"
  entrypoint = ["dockerd", "-H", "tcp://0.0.0.0:2375"]
  networks_advanced {
    name = docker_network.private_network.name
  }
}

This method doesn't work for me, even in privileged mode, I can't set host and a private network at the same time

Error: Unable to connect to network 'network-xxx': Error response from daemon: container sharing network namespace with another container or host cannot be connected to any other network
on main.tf line 158, in resource "docker_container" "dind":
158: resource "docker_container" "dind" {

Is there any solution around this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant