流浪者和码头供应商

编程入门 行业动态 更新时间:2024-10-23 21:26:13
本文介绍了流浪者和码头供应商的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

此问题也已发布到Vagrant Google Group。

This question has also been posted to the Vagrant Google Group.

我的环境:

OS-X 10.9.4 VirtualBox 5.012 r104815 Vagrant 1.7.4

尝试使用码头提供商,主机是geerlingguy / centos7

Trying to use docker provider, with the host machine being geerlingguy/centos7

通过放置:

config.vm.provision "docker"

在主机vagrant文​​件它自动配置我的主机与以下码头版本:

in host machine vagrant file it auto configures my host machine with the following docker version:

Version: 1.8.2-el7.centos API version: 1.20 Package Version: docker-1.8.2-10.el7.centos.x86_64 Go version: go1.4.2 Git commit: a01dc02/1.8.2 Built: OS/Arch: linux/amd64 Server: Version: 1.8.2-el7.centos API version: 1.20 Package Version: Go version: go1.4.2 Git commit: a01dc02/1.8.2 Built: OS/Arch: linux/amd64

我可以从中心运行docker容器,但是当我尝试从Dockerfile中构建docker容器时,我得到:

I can run docker containers from hub but when I try to build docker container from Dockerfile I get:

Command: "docker" "build" "/var/lib/docker/docker_build_1b35c3f0278e1a3b37d1578d7ce326e5" Stderr: Stdout: unable to prepare context: unable to evaluate symlinks in context path: lstat /var/lib/docker/docker_build_1b35c3f0278e1a3b37d1578d7ce326e5: permission denied

如果我将ssh移动到centos7主机并运行

If I vagrant ssh into centos7 host and run

docker build /var/lib/docker/docker_build_1b35c3f0278e1a3b37d1578d7ce326e5

我看到同样的错误,但如果我运行

I see same error but if I run

sudo docker build /var/lib/docker/docker_build_1b35c3f0278e1a3b37d1578d7ce326e5

构建运行。

I尝试:

config.ssh.username = 'root' config.ssh.password = 'vagrant' config.ssh.insert_key = 'true'

为主机,但是它没有找到docker命令。

for host machine but then it doesn't find docker command.

也许我应该添加我在做这在主机vagrantfile中:

Maybe I should add I am doing this in the host vagrantfile:

# Ensure vagrant user can run docker command config.vm.provision "shell", inline: "sudo groupadd docker;true" config.vm.provision "shell", inline: "sudo usermod -a -G docker vagrant;true" config.vm.provision "shell", inline: "docker version" config.vm.provision :reload

和vagrant可以运行码头工作者。

and vagrant can run docker.

这是它落在哪里(在docker vagrant文​​件中):

This is where it falls over (in the docker vagrant file):

config.vm.provider "docker" do |docker| docker.build_dir = /path/to/my/dockerfile/on/the/host/vm (FAILS WITH symlink ERROR) end

config.vm.provider "docker" do |docker| docker.image = hub/image end

将成功创建容器。

我一直在敲我的头2天 - 在虚拟框中阅读有关符号链接问题的各种各样的设置。尝试各种不同的设置。

I have been banging my head for 2 days - reading all sorts about symlink issues in virtualbox and tried all sorts of different settings.

有人可以建议我如何解决这个问题。

Can anybody advise how I should resolve this.

谢谢。

推荐答案

我的解决方案是在/ usr / bin / docker上设置粘码。

My solution was to set sticky bit on /usr/bin/docker.

这允许docker遵循sym链接并完成docker build 。不清楚,而不是完全确定错误在哪里。我基本上按照推荐的工作流程来建造有流浪汉的码头货柜。

This allowed docker to follow sym links and complete docker build. Obscure, and not totally sure where the fault lies. I was basically following the recommended workflow for building docker containers with vagrant.

更多推荐

流浪者和码头供应商

本文发布于:2023-10-07 12:54:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1469443.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:流浪者   码头   供应商

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!