Troubleshoot Visual Studio development with Docker
When you're working with Visual Studio Container Tools, you may encounter issues while building or debugging your application. Below are some common troubleshooting steps.
Volume sharing is not enabled. Enable volume sharing in the Docker CE for Windows settings (Linux containers only)
To resolve this issue:
- Right-click Docker for Windows in the notification area, and then select Settings.
- Select Shared Drives and share the system drive along with the drive where the project resides.
If files appear shared, you may still need to click the "Reset credentials..." link at the bottom of the dialog in order to re-enable volume sharing. To continue after you reset credentials, you might have to restart Visual Studio.
Visual Studio versions later than Visual Studio 2017 version 15.6 prompt when Shared Drives aren't configured.
When adding Docker support to a project, you choose either a Windows or a Linux container. The Docker host must be running the same container type. To change the container type in the running Docker instance, right-click the System Tray's Docker icon and choose Switch to Windows containers... or Switch to Linux containers....
Unable to start debugging
One reason could be related to having stale debugging components in your user profile folder. Execute the following commands to remove these folders so that the latest debugging components are downloaded on the next debug session.
- del %userprofile%\vsdbg
- del %userprofile%\onecoremsvsmon
Errors specific to networking when debugging your application
Try executing the script downloadable from Cleanup Container Host Networking, which will refresh the network-related components on your host machine.
When using Docker for macOS, you might encounter an error referencing the folder /usr/local/share/dotnet/sdk/NuGetFallbackFolder. Add the folder to the File Sharing tab in Docker
Docker users group
You might encounter the following error in Visual Studio when working with containers:
The current user must be in the 'docker-users' group to use Docker Desktop. Add yourself to the 'docker-users' group and then log out of Windows.
You must be a member of the 'docker-users' group in order to have permissions to work with Docker containers. To add yourself to the group in Windows 10, follow these steps:
- From the Start menu, open Computer Management.
- Expand Local Users and Groups, and choose Groups.
- Find the docker-users group, right-click and choose Add to group.
- Add your user account or accounts.
- Sign out and sign back in again for these changes to take effect.
You can also use the
net localgroup command at the Administrator command prompt to add users to specific groups.
net localgroup docker-users DOMAIN\username /add
In PowerShell, use the Add-LocalGroupMember function.
Low disk space
By default, Docker stores images in the %ProgramData%/Docker/ folder, which is typically on the system drive, *C:\ProgramData\Docker*. To prevent images from taking up valuable space on the system drive, you can change the image folder location. From the Docker icon on the task bar, open up Docker settings, choose Daemon, and switch from Basic to Advanced. In the editing pane, add the
graph property setting with the value of your desired location for Docker images:
Click Apply to restart Docker. These steps modify the configuration file at %ProgramData%\docker\config\daemon.json. Previously built images are not moved.
Microsoft/DockerTools GitHub repo
For any other issues you encounter, see Microsoft/DockerTools issues.