Help with docker provider

357 views
Skip to first unread message

Richard O'flynn

unread,
Jan 8, 2016, 6:59:22 AM1/8/16
to Vagrant
My environment:

OS-X 10.9.4
VirtualBox 5.012 r104815
Vagrant 1.7.4

Trying to use docker provider, with the guest VM being geerlingguy/centos7

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


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 

the build runs.

I tried:

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

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

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.

Thanks.

Alvaro Miranda Aguilera

unread,
Jan 8, 2016, 7:58:51 PM1/8/16
to vagra...@googlegroups.com
Hello richard, if you got all in 1 Vagrantfile can you sahre it for review? if you got more than 1 file, can you zip and share?

That will be easier to have a look locally and give it a go.

Thanks
Alvaro

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/cd413778-067c-4610-9bda-f570a47f79b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

dragon788

unread,
Jan 9, 2016, 10:38:17 PM1/9/16
to Vagrant
Make sure your provisioning script adds the vagrant user to the docker group so you don't have to sudo any docker commands. It will requiring logging out and back in or rebooting but then you should be good to go.

Richard O'flynn

unread,
Jan 11, 2016, 5:28:10 AM1/11/16
to Vagrant
I can confirm that I was adding the vagrant user to the docker group but this did not solve the issue. Adding sticky bit to /usr/bin/docker fixed the issue. More details can be found at:


Thanks to all who have offered support.
Reply all
Reply to author
Forward
0 new messages