gmacario / vagrant-ubuntu1404

Vagrant project for testing Ubuntu-desktop 14.04
Mozilla Public License 2.0
1 stars 3 forks source link

vagrant up --provider=docker fails to start #8

Closed gmacario closed 10 years ago

gmacario commented 10 years ago

On a machine where ~/tmp2 is linked to a directory on another filesystem, as in the example

gmacario@mv-linux-powerhorse:~⟫ ls -lad tmp2
lrwxrwxrwx 1 gmacario gmacario 27 Oct 22 12:20 tmp2 -> /opt/projects/gmacario/tmp/
gmacario@mv-linux-powerhorse:~⟫

if I try to create a VM using the --provider=docker I got the following error

gmacario@mv-linux-powerhorse:~⟫ cd ~/tmp2
gmacario@mv-linux-powerhorse:~/tmp2⟫ git clone git@github.com:gmacario/vagrant-ubuntu1404.git try-ubuntu1404-docker
Cloning into 'try-ubuntu1404-docker'...
remote: Counting objects: 161, done.
remote: Total 161 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (161/161), 33.34 KiB | 0 bytes/s, done.
Resolving deltas: 100% (77/77), done.
Checking connectivity... done.
gmacario@mv-linux-powerhorse:~/tmp2⟫ cd try-ubuntu1404-docker/
gmacario@mv-linux-powerhorse:~/tmp2/try-ubuntu1404-docker⟫ curl \
> https://raw.githubusercontent.com/phusion/baseimage-docker/master/image/insecure_key \
> >phusion.key
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1679  100  1679    0     0   4078      0 --:--:-- --:--:-- --:--:--  4085
gmacario@mv-linux-powerhorse:~/tmp2/try-ubuntu1404-docker⟫ vagrant up --provider=docker
Bringing machine 'default' up with 'docker' provider...
==> default: Creating the container...
    default:   Name: try-ubuntu1404-docker_default_1414499837
    default:  Image: phusion/baseimage
    default:    Cmd: /sbin/my_init --enable-insecure-key
    default: Volume: /opt/projects/gmacario/tmp/try-ubuntu1404-docker:/vagrant
    default:   Port: 2222:22
    default:
    default: Container created: 8cc12a4ba727f7ac
==> default: Waiting for container to enter "running" state...
The container started either never left the "stopped" state or
very quickly reverted to the "stopped" state. This is usually
because the container didn't execute a command that kept it running,
and usually indicates a misconfiguration.

If you meant for this container to not remain running, please
set the Docker provider configuration "remains_running" to "false":

  config.vm.provider "docker" do |d|
    d.remains_running = false
  end
1 gmacario@mv-linux-powerhorse:~/tmp2/try-ubuntu1404-docker⟫
gmacario commented 10 years ago

By inspecting the container logs it looks like the container does not start because it fails to mount the current directory under /vagrant

gmacario@mv-linux-powerhorse:~/tmp2/try-ubuntu1404-docker⟫ docker logs 8cc12a4ba727f7ac
lxc-start: No such file or directory - failed to mount '/opt/projects/gmacario/tmp/try-ubuntu1404-docker' on '/usr/lib/x86_64-linux-gnu/lxc///vagrant'
lxc-start: failed to setup the mount entries for '8cc12a4ba727f7ac93dbb83cee3f464f98f86b8eb53e70f2826632df6d747493'
lxc-start: failed to setup the container
lxc-start: invalid sequence number 1. expected 2
lxc-start: failed to spawn '8cc12a4ba727f7ac93dbb83cee3f464f98f86b8eb53e70f2826632df6d747493'
lxc-start: The container failed to start.
lxc-start: Additional information can be obtained by setting the --logfile and --log-priority options.
gmacario@mv-linux-powerhorse:~/tmp2/try-ubuntu1404-docker⟫
gmacario commented 10 years ago

It turned out that the root cause of this bug is not the symlinked directory, but rather the fact that Docker runs using the LXC provider

gmacario commented 10 years ago

Fixed with Commit 7f60021c7b1e03f1acf2f881b5d274af2d19dcdd (replacing Docker image phusion/baseimage with gmacario/baseimage)

gmacario commented 10 years ago

Also notified upstream project https://github.com/phusion/baseimage-docker

See Issue https://github.com/phusion/baseimage-docker/issues/159 and Pull Request https://github.com/phusion/baseimage-docker/pull/158

gmacario commented 10 years ago

Closing Issue for now.

Will consider reverting to d.image="phusion/baseimage" if/when Pull Request https://github.com/phusion/baseimage-docker/pull/158 is merged upstream.