GitHub Copilot can be used while VS Code is connected to a development container. Start with a working container and sign in through VS Code; you do not need to expose your host’s configuration directory or copy authentication tokens into the container.
The setup below keeps three separate concerns separate: creating the development environment, enabling Copilot in that VS Code window, and authenticating Git commands used by your project.
1. Open a working development container
Install VS Code and its Dev Containers extension, and use the Docker environment approved for your computer or development server. Open the project and inspect its existing .devcontainer/devcontainer.json before changing it. If none exists, run Dev Containers: Add Dev Container Configuration Files… from the Command Palette and select a configuration appropriate for the project.
Use Dev Containers: Reopen in Container. Confirm that the remote indicator identifies the container and that an integrated terminal can access the project. A Docker build failure or unavailable remote host must be fixed before troubleshooting Copilot. Follow the VS Code container setup guide for the host requirements.
2. Add extensions without exposing credentials
In the connected window, use Extensions to check the GitHub Copilot extensions and any installation action VS Code offers for that environment. VS Code distinguishes local and remote extension execution; do not assume that every extension needs two independent installations.
For a repeatable project configuration, merge this fragment into the existing file, retaining its image, build, mounts and other customizations. It is not a complete replacement configuration:
{
"customizations": {
"vscode": {
"extensions": [
"GitHub.copilot",
"GitHub.copilot-chat"
]
}
}
}
The supported nesting is described in the development-container configuration guide. If a rebuild is necessary, first save your work and preserve files outside persistent mounts: rebuilding replaces the container and can remove changes stored only in its writable layer.
Do not mount your entire host .config directory, copy tokens into the image, or commit a GITHUB_TOKEN as a Copilot setup step. Those actions can expose unrelated credentials and are not the sign-in workflow.
3. Sign in to Copilot in the connected window
Use the Copilot status-bar control and follow the Use AI Features sign-in flow if shown. Choose the GitHub account that has the intended access, whether an eligible Free account or an assigned paid entitlement. If multiple accounts are signed in, inspect Accounts → Manage Extension Account Preferences and the GitHub Copilot Chat account for this workspace or profile. See VS Code’s Copilot setup instructions.
Open an ordinary source file and test a simple chat request or an inline suggestion. Review generated code before accepting it. If the status reports disabled features, inspect the file’s language settings and organization policy; a blanket enable setting cannot override an administrator’s restriction.
Git authentication is separate. A credential helper or forwarded SSH agent may support Git fetch and push inside a container, as described in VS Code’s Git credential-sharing guide. Neither a successful Git command nor gh auth login proves that Copilot is signed in to the right account. Do not enable SSH agent forwarding solely for Copilot.
4. Check failures at the correct layer
- No Copilot controls: inspect Extensions in the connected window, installation errors and whether the extension is enabled.
- Access or account error: check the selected account and entitlement before rebuilding or changing Docker settings.
- Network error: inspect Copilot output or Chat Diagnostics. Test the network from the environment where the relevant component runs; a successful request to the GitHub home page does not test every Copilot service.
GitHub documents https://copilot-proxy.githubusercontent.com/_ping and https://api.githubcopilot.com/_ping for connectivity checks. A successful ping is only a network check, not proof of account access. Follow the official network troubleshooting guide with your administrator for proxy or certificate failures. Do not disable a required proxy or TLS validation, and remove tokens and private paths before sharing logs.
Official documentation checked October 14, 2026. UI labels can vary by VS Code version.