来自Docker snap package

时间:2017-05-02 15:48:37

标签: docker snap-package

我运行Ubuntu 16.04并通过快照包安装了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 的目录中的)时,我收到以下错误...

# 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的新手,有什么我想念的吗?

以下是Dockerfile的内容:

docker build . -t serial-wiring.base
  

注意:我已确认Failed to open library! - ./libdmlab.so dlopen: cannot load any more object with static TLS 在Windows上使用此Dockerfile工作。

1 个答案:

答案 0 :(得分:0)

由于不断变化的snappy模型中的限制问题,默认情况下Docker没有完全调整(see the discussion on the Snapcraft forum)。

获得一些有用的指导,说明如何解决(即打破)限制模型,直到适当的修复到位。您只需检查快照中打包的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现在可以正常运行。