lmakarov / boot2docker-vagrant

[DEPRECATED] Boot2docker Vagrant box for optimized Docker and Docker Compose use on Mac and Windows
145 stars 41 forks source link

Vagrant seems unable to "reload" this box #72

Closed luispabon closed 8 years ago

luispabon commented 8 years ago

I've been using your box for quite a while here over at phpdocker.io, it's been an absolute godsend. I've been experiencing the following however.

I'm not exactly sure where to report the issue as obviously this repo is for your share-optimised Vagrantfile, and the issue might be on the box itself.

Always get this error:

[development@localhost ~/P/p/z/phpdocker] (master) vagrant reload
==> default: Attempting graceful shutdown of VM...
The SSH connection was unexpectedly closed by the remote end. This
usually indicates that SSH within the guest machine was unable to
properly start up. Please boot the VM in GUI mode to check whether
it is booting properly.

When I query vagrant on the machine status, it is powered off:

[development@localhost ~/P/p/z/phpdocker] (master) [1] vagrant status
Current machine states:

default                   poweroff (virtualbox)

The VM is powered off. To restart the VM, simply run `vagrant up`

Vagrantfile:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure(2) do |config|
    config.vm.box = "blinkreaction/boot2docker"

    # Network config & shared folders
    config.vm.network "private_network", ip: "192.168.33.31"
    config.vm.synced_folder "..", "/home/docker/generic-php7", id: "generic-php7-dev"
    config.vm.synced_folder "~/.composer/", "/home/docker/.composer", id: "generic-php7-composer"

    # VM definition
    config.vm.provider "virtualbox" do |vb|
        vb.name = "Generic PHP7"
        vb.memory = 1024
        vb.cpus = 1
    end

    # Bring up containers
    config.vm.provision "shell", run: "always", inline: "cd /home/docker/generic-php7/phpdocker && docker-compose up -d 1>&2"

    # Redirect webserver port down 80, etc
    config.vm.provision "shell", run: "always", inline: "/usr/local/sbin/iptables -i eth1 -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 17000 1>&2"

    # Disable guest additions auto update as it won't work on boot2docker, and slows vm boot down boot
    if Vagrant.has_plugin?("vagrant-vbguest")
        config.vbguest.auto_update = false
    end
end

Other info:

I'm not sure what information you'll need to diagnose it?

lmakarov commented 8 years ago

Hi @luispabon

I've removed all shares and provisioning from your Vagrantfile:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure(2) do |config|
    config.vm.box = "blinkreaction/boot2docker"

    # Network config & shared folders
    config.vm.network "private_network", ip: "192.168.33.31"

    # VM definition
    config.vm.provider "virtualbox" do |vb|
        vb.name = "Generic PHP7"
        vb.memory = 1024
        vb.cpus = 1
    end

end

This works without any issues on my Mac. Check this on your setup.

BWT why do you need Vagrant on Ubuntu to run docker? We use this setup for our Mac and Windows user. Those on Linux can run containers directly. With the default vboxsf synced folder option, that you are using, the performance impact should be pretty bad.

luispabon commented 8 years ago

Thank you @lmakarov, I'll try this shortly.

I don't run my containers on vagrant on Ubuntu, I run them directly on bare metal for the reasons you stated. Roughly 70% of phpdocker.io's visitors are either on Mac or Windows, and it's for them we also generate a Vagrantfile using blinkreaction's boot2docker box.

I'm currently adding support for NFS and SMB to PHPDocker.io.

lmakarov commented 8 years ago

I'm going to close this, since the issue was apparently with a custom Vagrantfile. @luispabon feel free to reopen if necessary.