Skip to content

Docker agents are prone to failing #4305

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

Closed
ammario opened this issue Oct 1, 2022 · 2 comments
Closed

Docker agents are prone to failing #4305

ammario opened this issue Oct 1, 2022 · 2 comments
Labels
stale This issue is like stale bread.

Comments

@ammario
Copy link
Member

ammario commented Oct 1, 2022

By default, Docker containers are on their own network and access the host via host.docker.internal.

The existing (and non-obvious) workaround is to replace the Access URL in the init_script. See below:

  command = [
    "sh", "-c",
    <<EOT
    trap '[ $? -ne 0 ] && echo === Agent script exited with non-zero code. Sleeping infinitely to preserve logs... && sleep infinity' EXIT
    ${replace(coder_agent.main.init_script, "localhost", "host.docker.internal")}
    EOT
  ]

This approach is brittle because it strongly couples the template with the Access URL. In this example, if the Access URL is 127.0.0.1 and not localhost, the agent will never start.

@kylecarbs suggested we add a host attribute the coder_provider block that would contain the host.docker.internal isntead.

@ammario ammario added the bug label Oct 1, 2022
@ammario
Copy link
Member Author

ammario commented Oct 1, 2022

@kylecarbs I think this one is pretty high priority, as it tripped up Elliot during his attempt to try Coder, and half of our example templates fail depending on whether someone uses localhost or 127.0.0.1.

@github-actions
Copy link

github-actions bot commented Dec 1, 2022

This issue is becoming stale. In order to keep the tracker readable and actionable, I'm going close to this issue in 7 days if there isn't more activity.

@github-actions github-actions bot added the stale This issue is like stale bread. label Dec 1, 2022
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale This issue is like stale bread.
Projects
None yet
Development

No branches or pull requests

1 participant