Merge pull request #13 from microsoft/eg/fix-3933
Switch to dynamic port forwarding
This commit is contained in:
		@@ -19,7 +19,7 @@
 | 
				
			|||||||
	],
 | 
						],
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	// Use 'forwardPorts' to make a list of ports inside the container available locally.
 | 
						// Use 'forwardPorts' to make a list of ports inside the container available locally.
 | 
				
			||||||
	"forwardPorts": [3000],
 | 
						// "forwardPorts": [3000],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Specifies a command that should be run after the container has been created.
 | 
						// Specifies a command that should be run after the container has been created.
 | 
				
			||||||
	"postCreateCommand": "yarn install",
 | 
						"postCreateCommand": "yarn install",
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										15
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								README.md
									
									
									
									
									
								
							@@ -38,15 +38,12 @@ 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, then open a local browser and go to `http://localhost:3000` and note you can connect to the server in the container.
 | 
					   - Continue and from the notification that is shown open a browser. Note you can connect to the server in the container. 
 | 
				
			||||||
4. **Forward another port:**
 | 
					   - The status line shows '1 Port Available'. Clicking the status bar entry shows the 'Ports' view that lists the currently available ports.
 | 
				
			||||||
   - Stop debugging and remove the breakpoint.
 | 
					4. **Forward a port statically:**
 | 
				
			||||||
   - Open `server.js`
 | 
					You can also forward a port statically in the `.devcontainer/devcontainer.json` file.
 | 
				
			||||||
   - Change the server port to 5000. (`const PORT = 5000;`)
 | 
					   - Open the `.devcontainer/devcontainer.json` file.
 | 
				
			||||||
   - Press <kbd>F5</kbd> to launch the app in the container.
 | 
					   - Comment out the line with the definition of the `forwardedPorts` attribute and adjust the port number as needed.
 | 
				
			||||||
   - Press <kbd>F1</kbd> and run the **Forward a Port** command.
 | 
					 | 
				
			||||||
   - Select port 5000.
 | 
					 | 
				
			||||||
   - Click "Open Browser" in the notification that appears to access the web app on this new port.
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Contributing
 | 
					## Contributing
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user