examples: support both localhost and 127.0.0.1 in Docker examples (#4306)

And some minor fixes
This commit is contained in:
Ammar Bandukwala
2022-10-03 08:31:12 -05:00
committed by GitHub
parent 092a22f242
commit 78a39a809d
6 changed files with 6 additions and 6 deletions

View File

@ -61,7 +61,7 @@ resource "docker_container" "workspace" {
hostname = lower(data.coder_workspace.me.name)
dns = ["1.1.1.1"]
# Use the docker gateway if the access URL is 127.0.0.1
entrypoint = ["sh", "-c", replace(coder_agent.main.init_script, "127.0.0.1", "host.docker.internal")]
entrypoint = ["sh", "-c", replace(coder_agent.main.init_script, "/localhost|127\\.0\\.0\\.1/", "host.docker.internal")]
env = ["CODER_AGENT_TOKEN=${coder_agent.main.token}"]
host {
host = "host.docker.internal"