From the course: GitHub Codespaces for Students

Unlock this course with a free trial

Join today to access over 24,700 courses taught by industry experts.

Using ports in your container

Using ports in your container - Codespaces Tutorial

From the course: GitHub Codespaces for Students

Using ports in your container

- Every time you connect to any website, check your email, or jump on a video call with friends, the servers you're connecting to are using ports to send data back to you. Ports allow processes on a computer to communicate over a network. In this video, I'll show you how to set up ports in your dev container. We've previously done this manually using the ports tab. However, we can use our dev container to automate this process. First, we have to put all of the ports we want to use under the forwardPorts attribute. For example, if we had a website running on port 3000 and a server running the API for it on port 5000, this is what we'd have. Since our project just has a website running on port 3000, I'll just forward that. After committing our changes, if we created a new codespace, we would see the port is forwarded for us. But we can customize the ports even further. Imagine you have a codespace that uses a ton of ports,…

Contents