使用WSL&amp ;;跟随this tutorial bash我得到:
~$ cd /tmp/docker-nginx-test
/tmp/docker-nginx-test$ ls -la
total 0
drwxrwxrwx 0 george george 4096 Apr 21 06:27 .
drwxrwxrwt 0 root root 4096 Apr 21 06:02 ..
-rw-rw-rw- 1 george george 18 Apr 21 06:27 Dockerfile
/tmp/docker-nginx-test$ docker.exe build /tmp/docker-nginx-test
unable to prepare context: path "/tmp/docker-nginx-test" not found
也:
/tmp/docker-nginx-test$ docker.exe build ./Dockerfile
unable to prepare context: path "./Dockerfile" not found
/tmp/docker-nginx-test$ ls -al ./Dockerfile
-rwxrwxrwx 1 george george 18 Apr 21 06:27 ./Dockerfile
使用:
$ docker.exe --version
Docker version 18.03.0-ce, build 0520e24
答案 0 :(得分:0)
对于上面的教程,一个成功的方法与WSL& bash是要做的:
$ mkdir docker-nginx-test
$ cd docker-nginx-test
$ docker-compose.exe down
$ docker-compose.exe build --pull --no-cache
$ docker-compose.exe -f docker-compose.yml up -d --remove-orphans
答案 1 :(得分:0)
我发现问题是我只使用Linux路径(/home/user/project/Dockerfile
),但是我不得不使用Windows文件路径来存储WSL发行版,然后使用rootfs下的路径并逃脱反斜杠。像这样:
docker.exe build -t
C:\\Users\\username\\Ubuntu1804WSL\\CanonicalGroupLimited.Ubuntu18.04onWindows_1804.2018.817.0_x64__79rhkp1fndgsc\\rootfs\\home\\user\\scratch\\project
那为我解决了。