Skip to content

Commit f87b667

Browse files
committed
Fix service name and remove auto port forwarding for devcontainers
Removing auto port forwarding is because the workspace container is already using host networking. Therefore, there were port collisions occurring between VS Code and Docker Desktop. Removing this allows the ports to still be accessible without the race conditions
1 parent 6a70c95 commit f87b667

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
// The 'service' property is the name of the service for the container that VS Code should
1111
// use. Update this value and .devcontainer/compose.yml to the real service name.
12-
"service": "app",
12+
"service": "app-workspace",
1313

1414
// The optional 'workspaceFolder' property is the path VS Code should open by default when
1515
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
@@ -46,9 +46,14 @@
4646
"postCreateCommand": "npm install && npm run dev",
4747

4848
// Configure tool-specific properties.
49+
// Disabling auto forwarding of ports because the container is using the host network anyways.
50+
// If this isn't working for you, enable the "Host network" setting in Docker Desktop.
4951
"customizations": {
5052
"vscode": {
51-
"extensions": ["Orta.vscode-jest", "github.vscode-github-actions"]
53+
"extensions": ["Orta.vscode-jest", "github.vscode-github-actions"],
54+
"settings": {
55+
"remote.autoForwardPorts": false
56+
}
5257
}
5358
}
5459

0 commit comments

Comments
 (0)