Update remote port and readme

This commit is contained in:
bamurtaugh
2021-03-16 16:08:38 +00:00
parent 9a80e63b43
commit 3486e1e695
2 changed files with 10 additions and 8 deletions

View File

@@ -19,13 +19,7 @@
"terminal.integrated.shell.linux": "/bin/bash", "terminal.integrated.shell.linux": "/bin/bash",
"go.toolsManagement.checkForUpdates": "local", "go.toolsManagement.checkForUpdates": "local",
"go.gopath": "/go", "go.gopath": "/go",
"go.useLanguageServer": true, "go.useLanguageServer": true
"remote.portsAttributes": {
"9000": {
"label": "My Port",
"onAutoForward": "notify"
}
}
}, },
// Add the IDs of extensions you want installed when the container is created. // Add the IDs of extensions you want installed when the container is created.
@@ -39,6 +33,14 @@
// Use 'postCreateCommand' to run commands after the container is created. // Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "go version", // "postCreateCommand": "go version",
// Use 'portsAttributes' to set default properties for specific forwarded ports.
"portsAttributes": {
"9000": {
"label": "Hello Remote World",
"onAutoForward": "notify"
}
},
// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root. // Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode" "remoteUser": "vscode"
} }

View File

@@ -53,7 +53,7 @@ Some things to try:
- Continue (<kbd>F5</kbd>). You can connect to the server in the container by either: - Continue (<kbd>F5</kbd>). You can connect to the server in the container by either:
- Clicking on `Open in Browser` in the notification telling you: `Your service running on port 9000 is available`. - Clicking on `Open in Browser` in the notification telling you: `Your service running on port 9000 is available`.
- Clicking the globe icon in the 'Ports' view. The 'Ports' view gives you an organized table of your forwarded ports, and you can get there by clicking on the "1" in the status bar, which means your app has 1 forwarded port. - Clicking the globe icon in the 'Ports' view. The 'Ports' view gives you an organized table of your forwarded ports, and you can get there by clicking on the "1" in the status bar, which means your app has 1 forwarded port.
- Notice port 9000 in the 'Ports' view is labeled "My Port." In `devcontainer.json`, you can set `"remote.portsAttributes"`, such as a label for your forwarded ports and the action to be taken when the port is autoforwarded. - Notice port 9000 in the 'Ports' view is labeled "Hello Remote World." In `devcontainer.json`, you can set `"portsAttributes"`, such as a label for your forwarded ports and the action to be taken when the port is autoforwarded.
> **Note:** In Remote - Containers, you can access your app at `http://localhost:9000` in a local browser. But in a browser-based Codespace, you must click the link from the notification or the `Ports` view so that the service handles port forwarding in the browser and generates the correct URL. > **Note:** In Remote - Containers, you can access your app at `http://localhost:9000` in a local browser. But in a browser-based Codespace, you must click the link from the notification or the `Ports` view so that the service handles port forwarding in the browser and generates the correct URL.