Merge pull request #21 from microsoft/bamurtaugh/ports
Update port settings and README
This commit is contained in:
@@ -10,7 +10,13 @@
|
|||||||
|
|
||||||
// Set *default* container specific settings.json values on container create.
|
// Set *default* container specific settings.json values on container create.
|
||||||
"settings": {
|
"settings": {
|
||||||
"terminal.integrated.shell.linux": "/bin/bash"
|
"terminal.integrated.shell.linux": "/bin/bash",
|
||||||
|
"remote.portsAttributes": {
|
||||||
|
"3000": {
|
||||||
|
"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.
|
||||||
|
|||||||
12
README.md
12
README.md
@@ -50,10 +50,14 @@ Some things to try:
|
|||||||
- Add a breakpoint (e.g. on line 20).
|
- Add a breakpoint (e.g. on line 20).
|
||||||
- Press <kbd>F5</kbd> to launch the app in the container.
|
- Press <kbd>F5</kbd> to launch the app in the container.
|
||||||
- Once the breakpoint is hit, try hovering over variables, examining locals, and more.
|
- Once the breakpoint is hit, try hovering over variables, examining locals, and more.
|
||||||
- Continue (<kbd>F5</kbd>). You can connect to the server in the container by either: clicking on `Running on http://0.0.0.0:3000` in the terminal output, or "Open in Browser" next to port 3000 in the 'Ports' view (you can get to the 'Ports' view by clicking on the "1" in the status bar, which means your app has 1 forwarded port).
|
- 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 3000 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 access it with the command **Ports: Focus on Ports View**.
|
||||||
|
- Notice port 3000 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.
|
||||||
|
|
||||||
|
> **Note:** In Remote - Containers, you can access your app at `http://localhost:3000` 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:3000` in a local browser. But in a browser-based Codespace, you must click the link from the terminal output or the `Ports` view so that the service handles port forwarding in the browser and generates the correct URL.
|
4. **Rebuild or update your container**
|
||||||
4. **Rebuild or update your container** (*Currently, only containers with the VS Code Remote - Containers extension can be rebuilt.*)
|
|
||||||
|
|
||||||
You may want to make changes to your container, such as installing a different version of a software or forwarding a new port. You'll rebuild your container for your changes to take effect.
|
You may want to make changes to your container, such as installing a different version of a software or forwarding a new port. You'll rebuild your container for your changes to take effect.
|
||||||
|
|
||||||
@@ -63,7 +67,7 @@ Some things to try:
|
|||||||
|
|
||||||
- Open the `.devcontainer/devcontainer.json` file.
|
- Open the `.devcontainer/devcontainer.json` file.
|
||||||
- Uncomment the `forwardedPorts` attribute and adjust the port number as needed.
|
- Uncomment the `forwardedPorts` attribute and adjust the port number as needed.
|
||||||
- Press <kbd>F1</kbd> and select the **Remote-Containers: Rebuild Container** command so the modifications are picked up.
|
- Press <kbd>F1</kbd> and select the **Remote-Containers: Rebuild Container** or **Codespaces: Rebuild Container** command so the modifications are picked up.
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user