从Docker捕获包中,`sudo docker build .`失败

我运行的Ubuntu 16.04,我已经通过pipe理单元安装了docker。 docker build无法访问我的Dockerfile ,它设置在~的子目录。

捕捉界面似乎已正确连接…

 $ snap interfaces Slot Plug ... :home docker ... 

但是,当我调用docker build从包含Dockerfile的目录 ),我得到以下错误…

 $ sudo docker build . -t serial-wiring.base unable to prepare context: unable to evaluate symlinks in context path: lstat /home/<username>/Documents: permission denied 

我是Docker的新手,有什么我失踪的?

这里是Dockerfile的内容:

 # Base Image FROM ubuntu # Add Required Packages [Layer 1] RUN apt update && \ apt install -y ca-certificates cmake g++ git make --no-install-recommends # Download Sources [Layer 2] RUN cd ~ && \ git clone https://github.com/remote-wiring/serial-wiring.git && \ cd serial-wiring/ && \ mkdir build # Verify Build and Install CMD cd ~/serial-wiring/build/ && \ cmake .. && \ make 

注:我已经确认docker build . -t serial-wiring.base docker build . -t serial-wiring.base wiring.base在Windows上使用这个Dockerfile。

由于在不断发展的快速模型中的限制问题,默认情况下,Docker并不是完整的版本( 请参阅Snapcraft论坛上的讨论 )。

要获得一些有用的指导,了解如何解决(即打破)限制模型,直到适当的修复到位。 您可以简单地检查在快照中打包的Docker帮助应用程序。

 $ docker.help Docker snap: Docker Linux container runtime. Due to the confinement issues on snappy, it requires some manual setup to make docker-snap works on your machine. We'll take you through the steps needed to set up docker snap work for you on ubuntu core and ubuntu classic. On Ubuntu classic, before installing the docker snap, please run the following command to add the login user into docker group. sudo addgroup --system docker sudo adduser $USER docker newgrp docker On Ubuntu Core 16, after installing the docker snap from store, Firstly, you need to connect the two interfaces as they're not auto-connected by default. sudo snap connect docker:account-control :account-control sudo snap connect docker:home :home Secondly, reload the snap and allows the user to login to the new group "docker-snap". snap disable docker snap enable docker newgrp docker-snap Then have fun with docker in snappy. 

最后一个命令失败…

 $ newgrp docker-snap newgrp: group 'docker-snap' does not exist 

不过,我没有注意到任何失败的负面影响,现在Docker的function正如我所料。