Software⏱️ 2 min read📅 2026-06-03

How to Fix: Mount current directory as a volume in Docker on Windows 10

Mount current directory as a volume in Docker on Windows 10

Quick Answer: Use the `-v` flag with `docker run` to mount the current directory as a volume, e.g. `docker run -it --rm -v %cd%:/app my-image cmd /app/folder_on_windows_host.exe

To mount the current directory as a volume in Docker on Windows 10, you can use the `-v` option with the `docker run` command. This will allow you to access the container's filesystem from the host machine.

⚠️ Common Causes

  • Insufficient permissions on the host machine or container filesystem.

🔧 Proven Troubleshooting Steps

Method 1: Using the `-v` Option

  1. Step 1: Open a command prompt or PowerShell and navigate to the directory where you want to mount the container's filesystem.

Method 2: Creating an Alias

  1. Step 1: Create a new alias in your Windows system settings or PowerShell profile that points to the `docker run` command with the `-v` option.

✨ Wrapping Up

To mount the current directory as a volume in Docker on Windows 10, use the following command: docker run -it --rm -v %cd%:/app myimage. Replace `%cd%` with the path to your current working directory and `myimage` with the name of your Docker image. This will allow you to access the container's filesystem from the host machine.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions