I am trying to install docker in a vagrant box, I followed the steps on the docker website
But when I run vagrant up in the docker/ directory that is downloaded through git I get this error message.
"There is a syntax error in the following Vagrantfile. The syntax error
message is reproduced below for convenience:
/docker/Vagrantfile:146: syntax error, unexpected ':', expecting kEND
override.vm.synced_folder ".", "/vagrant", disabled: true"
How do I resolve this so that I can connect into the vagrant box, I get the same message is I run the command "vagrant ssh"
In the last version of vagrant
,the docker provisioner can support docker
now. Try it: http://docs.vagrantup.com/v2/provisioning/docker.html
Looks like you use an old version of Vagrant. Try to upgrade.
This can help.
This example vagrant file will install Docker version 1.3.2 for you. You can leave d.version out if you don't care what version of Docker gets downloaded.
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "hashicorp/precise64"
config.vm.provision "docker" do |d|
d.version = "1.3.2"
end
end
I built a very basic vagrantfile that sets up ubuntu with docker installed.
I use it occasionally for testing docker
https://github.com/thestonefox/vagrant-docker
My experience:
I was behind a proxy so I had to configure it in vagrant. First I install the plugin to set the proxy:
vagrant plugin install vagrant-proxyconf
Then I completed the example above:
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "hashicorp/precise64"
config.yum_proxy.http = "http://proxy.internal.lcl:8080/"
config.proxy.http = "http://proxy.internal.lcl:8080/"
config.proxy.https = "http://proxy.internal.lcl:8080/"
config.proxy.no_proxy = "localhost,127.0.0.1"
config.vm.provision "docker" do |d|
d.version = "latest"
end
end
Finally I had to bypass the proxy somehow for docker with this shell command:
export NO_PROXY="/var/run/docker.sock"
Result:
root@precise64:~# docker version
Client version: 1.5.0
Client API version: 1.17
Go version (client): go1.4.1
Git commit (client): a8a31ef
OS/Arch (client): linux/amd64
Server version: 1.5.0
Server API version: 1.17
Go version (server): go1.4.1
Git commit (server): a8a31ef
Hope it helps.