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

@ -44,7 +44,7 @@ Connect to your workspace via SSH:
coder ssh <workspaceName> coder ssh <workspaceName>
``` ```
To access your workspace in the Coder dashboard, navigate to the [configured access URL](./install/configure.md), To access your workspace in the Coder dashboard, navigate to the [configured access URL](../admin/configure#access-url),
and log in with the owner credentials provided to you by Coder. and log in with the owner credentials provided to you by Coder.
![Coder Web UI with code-server](./images/code-server.png) ![Coder Web UI with code-server](./images/code-server.png)

View File

@ -61,7 +61,7 @@ resource "docker_container" "workspace" {
hostname = lower(data.coder_workspace.me.name) hostname = lower(data.coder_workspace.me.name)
dns = ["1.1.1.1"] dns = ["1.1.1.1"]
# Use the docker gateway if the access URL is 127.0.0.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}"] env = ["CODER_AGENT_TOKEN=${coder_agent.main.token}"]
host { host {
host = "host.docker.internal" host = "host.docker.internal"

View File

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

View File

@ -57,7 +57,7 @@ resource "docker_container" "workspace" {
name = "coder-${data.coder_workspace.me.owner}-${lower(data.coder_workspace.me.name)}" name = "coder-${data.coder_workspace.me.owner}-${lower(data.coder_workspace.me.name)}"
dns = ["1.1.1.1"] dns = ["1.1.1.1"]
# Refer to Docker host when Coder is on localhost # Refer to Docker host when Coder is on localhost
command = ["sh", "-c", replace(coder_agent.main.init_script, "127.0.0.1", "host.docker.internal")] command = ["sh", "-c", replace(coder_agent.main.init_script, "/localhost|127\\.0\\.0\\.1/", "host.docker.internal")]
env = ["CODER_AGENT_TOKEN=${coder_agent.main.token}"] env = ["CODER_AGENT_TOKEN=${coder_agent.main.token}"]
host { host {
host = "host.docker.internal" host = "host.docker.internal"

View File

@ -83,7 +83,7 @@ resource "docker_container" "workspace" {
"sh", "-c", "sh", "-c",
<<EOT <<EOT
trap '[ $? -ne 0 ] && echo === Agent script exited with non-zero code. Sleeping infinitely to preserve logs... && sleep infinity' EXIT 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")} ${replace(coder_agent.main.init_script, "/localhost|127\\.0\\.0\\.1/", "host.docker.internal")}
EOT EOT
] ]
env = ["CODER_AGENT_TOKEN=${coder_agent.main.token}"] env = ["CODER_AGENT_TOKEN=${coder_agent.main.token}"]

View File

@ -21,7 +21,7 @@ export const UserRoleHelpTooltip: FC = () => {
<HelpTooltipTitle>{Language.title}</HelpTooltipTitle> <HelpTooltipTitle>{Language.title}</HelpTooltipTitle>
<HelpTooltipText>{Language.text}</HelpTooltipText> <HelpTooltipText>{Language.text}</HelpTooltipText>
<HelpTooltipLinksGroup> <HelpTooltipLinksGroup>
<HelpTooltipLink href="https://coder.com/docs/coder-oss/latest/users#user-roles"> <HelpTooltipLink href="https://coder.com/docs/coder-oss/latest/admin/users#roles">
{Language.link} {Language.link}
</HelpTooltipLink> </HelpTooltipLink>
</HelpTooltipLinksGroup> </HelpTooltipLinksGroup>