C:\temp\docker_test>docker container run --rm -v "$(pwd):/data" alpine ls /data
C:\Program Files\Docker\Docker\Resources\bin\docker.EXE: Error response from daemon: create $(pwd): "$(pwd)" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If u intended to pass a host directory, use absolute path.
See 'C:\Program Files\Docker\Docker\Resources\bin\docker.EXE run --help'.
C:\temp\docker_test>docker container run --rm -v "c:\temp\docker_test:/data" alpine ls /data
Dockerfile
test1.txt
test2.txt
test3.txt
The latter attempt with passing current dir explicitly worked fine.
C:\temp\docker_test>docker container run --rm alpine ls /var/www/test
ls: /var/www/test: No such file or directory
Now another questions: Seems you create a webserver.
I try to run YII project and started with yiisoftware/yii2-php:5.6-fpm-17.12.0 image but run into COPY issue. Thought it was the image issue, tried alpine image, but it didnt help.
C:\temp\docker_test>docker container run --rm -it alpine
/ # ls /var/www
ls: /var/www: No such file or directory
/ # mkdir -p /var/www/test
/ # ls /var/www
test
COPY works even without RUN mkdir before, as it should. The issue was because i had comment at the end of copy row in my original Dockfile! Haven’t mentioned it because even couldn’t think it could matter.
Works:
FROM alpine
COPY . /var/www/test/
Doesn’t work:
FROM alpine
COPY . /var/www/test/ # TODO change path in PROD
Sending build context to Docker daemon 5.12kB
Step 1/2 : FROM alpine
---> 5cb3aa00f899
Step 2/2 : COPY . /var/www/test/ # TODO change path in PROD
COPY failed: stat /var/lib/docker/tmp/docker-builder329756868/var/www/test: no such file or directory
Docker treats lines that begin with # as a comment, unless the line is a valid parser directive. A # marker anywhere else in a line is treated as an argument.