Skip to content

Instantly share code, notes, and snippets.

@goldeneggg
Created May 2, 2014 09:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goldeneggg/fb5141c0cf72811594f2 to your computer and use it in GitHub Desktop.
Save goldeneggg/fb5141c0cf72811594f2 to your computer and use it in GitHub Desktop.
provisionerにdockerを指定して vagrant up するとコケる (bash: line 2: stop: command not found)

推測

  • vagrant up時にdockerのrestartを実行しようとしている
  • その際の実行ユーザーがvagrantなんだけど、restartする権限が無い

ログ

  • version = 1.5.4
% vagrant -v
Vagrant 1.5.4
  • Vagrantfile
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.define :vmwheezydocker do |vmwheezydocker|
    vmwheezydocker.vm.box = "debian_wheezy_64_vanilla"
    vmwheezydocker.vm.box_url = "https://dl.dropboxusercontent.com/s/3jz559mjz2aw4gs/debian-wheezy-64-vanilla.box"

    vmwheezydocker.vm.hostname = "vmwheezydocker"
    vmwheezydocker.vm.network :private_network, ip: "192.168.56.112"

    vmwheezydocker.vm.provider :virtualbox do |vb|
      vb.customize ["modifyvm", :id, "--memory", 768]
    end

    vmwheezydocker.vm.provision :docker do |d|
      d.pull_images "ubuntu"
    end
  end
end
  • vagrant up
% vagrant up

==> vmwheezydocker: Running provisioner: docker...
    vmwheezydocker: Installing Docker (latest) onto machine...
    vmwheezydocker: Configuring Docker to autostart containers...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

stop docker

Stdout from the command:



Stderr from the command:

stdin: is not a tty
bash: line 2: stop: command not found
  • VM確認
    • dockerコマンドがvagrantユーザーだとパーミッションエラー
    • sudo付きだとOK
    • vagrant ver1.4時代はvagrantユーザーでも問題なかった
    • vagrantかdockerいずれかのバージョンアップに起因して挙動が変わった?
% vagrant ssh

$ which docker
/usr/bin/docker

$ docker -v
Docker version 0.10.0, build dc9c28f

$ docker images
2014/05/02 09:04:38 dial unix /var/run/docker.sock: permission denied

$ sudo docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment