Mount Paths in a WSL Docker Environment

Asked 2 years ago, Updated 2 years ago, 402 views

What do you want to solve
I'm going to join Kaggle by building a Docker environment using WSL2 on Windows 11 and using the Jupiternotbook.

However, I was able to implement the above, but when I tried to mount the local drive for data, I got an error and I couldn't.

Can someone tell me how to solve it?

Run Environment
Windows 11
WSL2
Docker for Windows Container-Ubuntu 20.13 LTS

problems/errors you are experiencing

 docker: Error response from daemon: invalid mode: /new.
See'docker run --help'.

Affected Source Code

$docker run-p8888:888-v "//C://Users//username//OneDrive//Desktop//Kaggle Folder//Test":/new ubuntu

What I tried
Tried 1:
I made it an absolute path and gave two /s each.

"//C://Users//username//OneDrive//Desktop//Kaggle Folder//Test"

Tried 2:
If you don't add "", the image will get a lower case error, so I turned it on.

Tried 3:
Attempted to name the Container folder path bin or something else.

I look forward to your kind cooperation.

windows docker wsl wsl-2

2022-09-30 22:00

1 Answers

If you are running the docker command on a WSL2 Ubuntu or something like that, it is recommended that the path be in a format recognizable by Ubuntu or something like that.

For example, drive C on the Windows side is mounted in /mnt/c on the WSL side, so you can do the following:

docker run-p8888:8888-v"/mnt/c/Users/username/OneDrive/Desktop/Kaggle/Folder/Test:/new" ubuntu


2022-09-30 22:00

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.