Sebastian Faltoni Software Architect. Passionate about Clean Code, Tech, Web, AI, .NET, Python, IOT, Swift, SwiftUI and also Blazor

Enable drive sharing for docker on windows

45 sec read

Without enabling Drive Sharing for your drive where your code resides you could get the following error from Visual Studio

error CTP1002: An error occurred while attempting to run Docker container.

If you want to enable your containers to access files on your local windows filesystem you need to enable to do so on Docker, this will work for both Visual Studio Docker Tools and containers that you execute from the command line and is needed for Linux Containers.

On your Docker Tray Icon right click to open this context menu and click on Settings

Then on the Settings Windows go to Shared Drives Sections and make sure you have selected all the drives on which you want to enable filesystem access from your containers, then click Apply it should ask for your Windows Credentials, then hit enter and wait for Docker to apply the settings.

Now you can start your containers and have access to the filesystem, with this you could for example run a container that access your local source code to run it on nginx or apache in case for example of a wordpress website, or you could use it as a Development environment for GoLang with VSCode Remote Extension.

REFERENCES

Sebastian Faltoni Software Architect. Passionate about Clean Code, Tech, Web, AI, .NET, Python, IOT, Swift, SwiftUI and also Blazor

Leave a Reply

Your email address will not be published. Required fields are marked *