Docker: unable to prepare context: unable to evalu

2019-01-21 21:28发布

I just downloaded Docker Toolbox for Windows 10 64bit today. I'm going through the tutorial. I'm receving the following error when trying to build an image using a Dockerfile.

Steps:

  • Launched Docker Quickstart terminal.
  • testdocker after creating it.
  • Prepare Dockerfile as documented in "Build your own image" web link
  • ran "docker build -t docker-whale ."

Error: $ docker build -t docker-whale . unable to prepare context: unable to evaluate symlinks in Dockerfile path: GetFileAttributesEx C:\Users\Villanueva\Test\testdocker\Dockerfile: The system cannot find the file specified.

BTW: I tried several options mentioned @ https://github.com/docker/docker/issues/14339

    $ docker info
    Containers: 4
     Running: 0
     Paused: 0
     Stopped: 4
    Images: 2
    Server Version: 1.10.1
    Storage Driver: aufs
     Root Dir: /mnt/sda1/var/lib/docker/aufs
     Backing Filesystem: extfs
     Dirs: 20
     Dirperm1 Supported: true
    Execution Driver: native-0.2
    Logging Driver: json-file
    Plugins:
     Volume: local
     Network: bridge null host
    Kernel Version: 4.1.17-boot2docker
    Operating System: Boot2Docker 1.10.1 (TCL 6.4.1); master : b03e158 - Thu Feb 11 22:34:01 UTC 2016
    OSType: linux
    Architecture: x86_64
    CPUs: 1
    Total Memory: 996.2 MiB
    Name: default
    ID: C7DS:CIAJ:FTSN:PCGD:ZW25:MQNG:H3HK:KRJL:G6FC:VPRW:SEWW:KP7B
    Debug mode (server): true
     File Descriptors: 32
     Goroutines: 44
     System Time: 2016-02-19T17:37:37.706076803Z
     EventsListeners: 0
     Init SHA1:
     Init Path: /usr/local/bin/docker
     Docker Root Dir: /mnt/sda1/var/lib/docker
    Labels:
     provider=virtualbox

16条回答
唯我独甜
2楼-- · 2019-01-21 21:45

The issue is related to the DockerFile creation procedure.

In order to work, open cmd, cd to the directory of interest and type:

abc>DockerFile

This will create a file called DockerFile inside your folder.

Now type:

notepad DockerFile 

This will open the DockerFile file in notepad and you will have to copy/paste the standard code provided.

Save the file and now, finally, build your image with Docker typing:

docker build -t docker-whale . 

This is working for me and I hope it helps others

查看更多
女痞
3楼-- · 2019-01-21 21:47

I got this on Windows when the path I was working in was under a Junction directory. So my fix was to not work under that path.

查看更多
Root(大扎)
4楼-- · 2019-01-21 21:48

In windows 10... period is first parameter

docker build . -t docker-whale

查看更多
做自己的国王
5楼-- · 2019-01-21 21:48

I had created my DockerFile by VS2017 Docker Support tool and had the same error. After a while I realised I was not in the correct directory that contains the Dockerfile (~\source\repos\DockerWebApplication). Cd'ed to the correct file (~/source/repos/DockerWebApplication/DockerWebApplication) which was inside the project and successfully created the docker image.

查看更多
爷、活的狠高调
6楼-- · 2019-01-21 21:49

That's just because Notepad add ".txt" at the end of Dockerfile

查看更多
一夜七次
7楼-- · 2019-01-21 21:50

I had originally created my Dockerfile in PowerShell and though I didn't see an extension on the file it showed as a PS File Type...once I created the file from Notepad++ being sure to select the "All types (.)" File Type with no extension on the File Name (Dockerfile). That allowed my image build command to complete successfully....Just make sure your Dockerfile has a Type of "File"...

查看更多
登录 后发表回答