fnichol / dvm

An on demand Docker virtual machine, thanks to Vagrant and boot2docker. Works great on Macs and other platforms that don't natively support the Docker daemon. Support VirtualBox, VMware, and Parallels.
http://fnichol.github.io/dvm
Apache License 2.0
458 stars 71 forks source link

Fixes inability to stop or delete containers if DOCKER_ARGS used #21

Closed yacn closed 10 years ago

yacn commented 10 years ago

Problem

If you set DOCKER_ARGS to anything in dvm.conf, you will be unable to stop or delete containers. For an example of what happens, you can look over this gist.

Solution

The solution is to modify the sed command to save the -g parameter passed into Docker in its init file. This parameter is needed because the directory docker expects (/var/lib/docker) is a symlink to /mnt/sda/var/lib/docker. See this thread for more information.

With the changes in this pull request, this will no longer happen:

|ruby-1.9.3-p448| isaacs-air in ~/git/yacn/dvm/tmp
± |fix/unable-to-stop-delete-containers ✗| → mv ~/.dvm/{fixed_,}Vagrantfile

|ruby-1.9.3-p448| isaacs-air in ~/git/yacn/dvm/tmp
± |fix/unable-to-stop-delete-containers ✗| → dvm up
Bringing machine 'dvm' up with 'virtualbox' provider...
[dvm] Importing base box 'boot2docker-0.5.4-1'...
*vagrant SNIP*
[dvm] Running provisioner: shell...
[dvm] Running: inline script
boot2docker: 0.5.4
---> Configuring docker with args '-H unix:// -H tcp://' and restarting

|ruby-1.9.3-p448| isaacs-air in ~/git/yacn/dvm/tmp
± |fix/unable-to-stop-delete-containers ✗| → kitchen list
Instance Driver Provisioner Last Action
default-ubuntu Docker ChefZero <Not Created>

|ruby-1.9.3-p448| isaacs-air in ~/git/yacn/dvm/tmp
± |fix/unable-to-stop-delete-containers ✗| → kitchen create
-----> Starting Kitchen (v1.2.1)
-----> Creating <default-ubuntu>...
Step 0 : FROM ubuntu
Pulling repository ubuntu
*kitchen create SNIP*
Finished creating <default-ubuntu> (3m8.39s).
-----> Kitchen is finished. (3m8.43s)

|ruby-1.9.3-p448| isaacs-air in ~/git/yacn/dvm/tmp
± |fix/unable-to-stop-delete-containers ✗| → kitchen destroy
-----> Starting Kitchen (v1.2.1)
-----> Destroying <default-ubuntu>...
2118a87d5cf2f5d6bc502a3f086b4ab828e6c3023624e2da9e8590eae043ec1f
2118a87d5cf2f5d6bc502a3f086b4ab828e6c3023624e2da9e8590eae043ec1f
Finished destroying <default-ubuntu> (0m0.14s).
-----> Kitchen is finished. (0m0.20s)

|ruby-1.9.3-p448| isaacs-air in ~/git/yacn/dvm/tmp
± |fix/unable-to-stop-delete-containers ✗| → kitchen list
Instance Driver Provisioner Last Action
default-ubuntu Docker ChefZero <Not Created>

|ruby-1.9.3-p448| isaacs-air in ~/git/yacn/dvm/tmp
± |fix/unable-to-stop-delete-containers ✗| →

(you can view the full output here)

I used this .kitchen.yml with this dvm.conf to confirm.

fnichol commented 10 years ago

@yacn, you are amazing, that is an awesome write up! So sorry this took weeks longer to pull in.