Develop code using GitHub Codespaces and Visual Studio Code!
Nice work! 🎉 You created your first codespace and pushed code using VS Code!
You can configure the development container for a repository so that any codespace created for that repository will give you a tailored development environment, complete with all the tools and runtimes you need to work on a specific project.
What are development containers? Development containers, or dev containers, are Docker containers that are specifically configured to provide a fully featured development environment. Whenever you work in a codespace, you are using a dev container on a virtual machine.
A dev container file is a JSON file that lets you customize the default image that runs your codespace, VS code settings, run custom code, forward ports and much more!
Let's add a devcontainer.json
file and add a custom image.
-
Navigating back to your Code tab of your repository, click the Add file drop-down button, and then click
Create new file
. -
Type or paste the following in the empty text field prompt to name your file.
.devcontainer/devcontainer.json
-
In the body of the new .devcontainer/devcontainer.json file, add the following content:
{ // Name this configuration "name": "Codespace for Skills!", // Use the base codespace image "image": "mcr.microsoft.com/vscode/devcontainers/universal:latest", "remoteUser": "codespace", "overrideCommand": false }
-
Click Commit changes and then select Commit changes directly to the
main
branch. -
Create a new codespace by navigating back to the Code tab of your repository.
-
Click the green Code button located in the middle of the page.
-
Click the Codespaces tab on the box that pops up.
-
Click the Create codespace on main button OR click the
Wait about 2 minutes for the codespace to spin itself up.
-
Verify that your new codespace is is running, as you did previously.
Note the image being used is the default image provided for GitHub Codespaces. It includes runtimes and tools for Python, Node.js, Docker, and more. See the full list here: https://aka.ms/ghcs-default-image. Your development team can use any custom image that has the necessary prerequisites installed. For more information, see codespace image.
-
Wait about 20 seconds then refresh this page (the one you're following instructions from). GitHub Actions will automatically update to the next step.
Get help: Post in our discussion board • Review the GitHub status page
© 2023 GitHub • Code of Conduct • MIT License