Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4afc66f

Browse files
authored
chore: remove docker host from docker-compose (#1596)
1 parent0b1a35f commit4afc66f

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

‎docker-compose.yaml‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ services:
66
-"7080:7080"
77
environment:
88
CODER_PG_CONNECTION_URL:"postgresql://${POSTGRES_USER:-username}:${POSTGRES_PASSWORD:-password}@database/${POSTGRES_DB:-coder}?sslmode=disable"
9+
# You'll need to set CODER_ACCESS_URL to an IP or domain
10+
# that workspaces can reach. This cannot be localhost
11+
# or 127.0.0.1 for non-Docker templates!
912
CODER_ADDRESS:"0.0.0.0:7080"
10-
# You'll need to set CODER_ACCESS_URL to an
11-
# externally-reachable IP to use non-Docker examples!
12-
CODER_ACCESS_URL:"${CODER_ACCESS_URL:-http://host.docker.internal:7080}"
13+
CODER_ACCESS_URL:"${CODER_ACCESS_URL}"
1314
volumes:
1415
-/var/run/docker.sock:/var/run/docker.sock
1516
depends_on:

‎examples/docker-image-builds/main.tf‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,9 @@ resource "docker_container" "workspace" {
9494
# Hostname makes the shell more user friendly: coder@my-workspace:~$
9595
hostname=lower(data.coder_workspace.me.name)
9696
dns=["1.1.1.1"]
97-
command=["sh","-c",coder_agent.dev.init_script]
98-
env=["CODER_AGENT_TOKEN=${coder_agent.dev.token}"]
97+
# Use the docker gateway if the access URL is 127.0.0.1
98+
command=["sh","-c",replace(coder_agent.dev.init_script,"127.0.0.1","host.docker.internal")]
99+
env=["CODER_AGENT_TOKEN=${coder_agent.dev.token}"]
99100
host {
100101
host="host.docker.internal"
101102
ip="host-gateway"

‎examples/docker/main.tf‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ variable "step2_arch" {
4747
provider"docker" {
4848
host="unix:///var/run/docker.sock"
4949
}
50-
5150
provider"coder" {
5251
}
5352

@@ -82,8 +81,9 @@ resource "docker_container" "workspace" {
8281
# Hostname makes the shell more user friendly: coder@my-workspace:~$
8382
hostname=lower(data.coder_workspace.me.name)
8483
dns=["1.1.1.1"]
85-
command=["sh","-c",coder_agent.dev.init_script]
86-
env=["CODER_AGENT_TOKEN=${coder_agent.dev.token}"]
84+
# Use the docker gateway if the access URL is 127.0.0.1
85+
command=["sh","-c",replace(coder_agent.dev.init_script,"127.0.0.1","host.docker.internal")]
86+
env=["CODER_AGENT_TOKEN=${coder_agent.dev.token}"]
8787
host {
8888
host="host.docker.internal"
8989
ip="host-gateway"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp