3

Installing on Ubuntu 13.06 x64, it's an OpenVZ virtual machine.

Followed the script to the letter, and received a couple errors...

root@dev:/# sudo apt-get install linux-image-extra-`uname -r`
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package linux-image-extra-2.6.32-042stab081.3
E: Couldn't find any package by regex 'linux-image-extra-2.6.32-042stab081.3'
root@dev:/#

though I am able to to:

root@dev:/# uname -r
2.6.32-042stab081.3
root@dev:/#

Then when I attempt to install I receive the following (this is a second attempt, so obviously stripped down)

root@dev:/# sudo apt-get install lxc-docker
Reading package lists... Done
Building dependency tree
Reading state information... Done
lxc-docker is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
4 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
Setting up lxc (0.9.0-0ubuntu3.4) ...
start: Job failed to start
invoke-rc.d: initscript lxc-net, action "start" failed.
dpkg: error processing lxc (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of lxc-templates:
 lxc-templates depends on lxc (>= 0.8.0~rc1-4ubuntu43); however:
  Package lxc is not configured yet.

dpkg: error processing lxc-templates (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of lxc-docker-0.6.3:
 lxc-docker-0.6.3 depends on lxc; however:
  Package lxc is not configured yet.

dpkg: error processing lxc-docker-0.6.3 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of lxc-docker:
lxc-docker depends on lxc-docker-0.6.3; however:
  Package lxc-docker-0.6.3 is not configured yet.

dpkg: error processing lxc-docker (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 lxc
 lxc-templates
 lxc-docker-0.6.3
 lxc-docker
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@dev:/#

2 Answers 2

9

There are two distinct problems here.

  1. Missing linux-image-extra-$(uname -r) package.

    This is because the Docker installation script makes the bold assumption that if you are running kernel e.g. 3.8.0-30, it was installed from the package linux-image-3.8.0-30, and there should be a package linux-image-extra-3.8.0-30 containing extra files (including the AUFS module, which is necessary to run Docker). If you are running a kernel which is not a stock Ubuntu kernel, this assumption will be false, the linux-image-extra-... package won't exist, and the script will fail miserably.

    However, if you know that you have AUFS support in your kernel (or that the AUFS module for your kernel is installed one way or another), you can safely skip this step.

    Admittedly, the install script should investigate a bit more about your environment, and try to install this -extra- package only when it makes sense.

  2. Cannot install lxc package inside an OpenVZ container.

    The postinstall script of the lxc package tries to start the lxc-net service, which tries to setup the lxcbr0 bridge. I don't have an OpenVZ environment here to test this, but I think that you cannot create a bridge within an OpenVZ environment. Therefore, the service fails to start, and the postinstall script reports a failure, and the lxc package cannot be recorded as "installed", and the Docker package (lxc-docker) doesn't want to install if its dependencies are not correctly installed.

    You can work around this by preventing the service from starting; for instance by doing:

    echo exit 101 | sudo tee /usr/sbin/policy-rc.d
    sudo chmod +x /usr/sbin/policy-rc.d
    

    However, I am almost sure that you won't be able to run Docker within OpenVZ, because you won't be able to run containers inside OpenVZ. Again, I don't have an OpenVZ environment to test; but I would be very surprised if that worked.

I strongly suggest to run Docker on a more recent kernel (e.g. 3.8), and not inside OpenVZ.

However, if you absolutely need to run Docker within OpenVZ, there is a way to do it; but it is very hackish. There will be a performance hit, and there might be side-effects. If you want to try anyway, you can check Sekexe. It will let you start arbitrary processes within a user-mode-linux kernel. I have used it successfully to run Docker tests within Travis CI. I wouldn't recommend it for anything else, though.

1
  • Thank you very much for your long and detailed reply. I believe you are correct in the fact that I cannot run docker inside of an OpenVZ instance -- my main guess is because of bridging not allowed in OpenVZ, as you mentioned. Thanks for your help, on to the next project... Oct 2, 2013 at 18:01
0

I was playing a bit with sekexe, but I totally agree with jpetazzo; it's cool but not for production. Instead I started using debootstrap + chrooted jails to have a similar Docker-ish experience (but not as cool as docker of course).

You might want to check this: http://coderofsalvation.github.io/debootstrap-container

I'm using this now on an OpenVZ VPS to separate packages/projects in tidy containers. Disclaimer: I am the author.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.