简体   繁体   中英

Docker: Invalid characters (%cd%) for local volume - Windows 10

When trying to mount a local volume using docker run on Windows 10, Docker version 20.10.12, using

docker run -it -v -p 3000:3000 %cd%:/usr/src/app rails6

I get the error response:

docker: Error response from daemon: create %cd%: "%cd%" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path.

The solution was to run in PowerShell, using the delimited, automatic variable ${pwd} .

docker run -it -v -p 3000:3000 ${pwd}:/usr/src/app rails6

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM