简体   繁体   English

将Docker安装到运行Ubuntu 12.04的VirtualBox VM中

[英]Installing docker into a VirtualBox VM running Ubuntu 12.04

I have virtual box in my ubuntu 14.4 system and vagrant is installed in virtual box. 我的ubuntu 14.4系统中有虚拟盒,而vagrant安装在虚拟盒中。 But if i try to install docker into vagrant virtual machine and used below command in vagrant machine 但是如果我尝试将docker安装到无业游民的虚拟机中并在无业游民的计算机中使用以下命令
'docker --version ' 'docker --version'

It shows docker version and options like -help -display - color 它显示docker版本和选项-help -display-color

but when i try to run docker with below command 'sudo docker run -t -i ubuntu:12.04 /bin/bash' 但是当我尝试使用下面的命令'sudo docker run -t -i ubuntu:12.04 / bin / bash'运行docker时

It showing below error 'its not entering into bash mode of docker' 它显示以下错误“未进入docker的bash模式”

To clarify: 澄清:

  • VirtualBox runs virtual machines (VMs) VirtualBox运行虚拟机(VM)
  • Docker runs containers Docker运行容器
  • Vagrant is a declarative interface for VirtualBox VMs (and other providers ) Vagrant是VirtualBox VM(和其他提供程序 )的声明性接口

If you have installed vagrant inside a VirtualBox VM, you would also need to install VirtualBox into that VM to be able to use Vagrant with it. 如果您已经在VirtualBox VM中安装了vagrant,则还需要将VirtualBox安装到该VM中才能使用Vagrant。 This is probably not what you want to do. 这可能不是您想要的。

Docker should probably be installed and run from your Ubuntu host, as this will give you greater performance than host->VM->docker. 可能应该从您的Ubuntu主机上安装并运行Docker,因为这将为您提供比host-> VM-> docker更高的性能。

On Ubuntu 12:04 the kernel must be upgraded and docker installation is more difficult. 在Ubuntu 12:04上,必须升级内核,而docker安装更加困难。 The docker package shipped with 12:04 is not the docker you expect it to be if it outputs this: 如果输出以下内容,则12:04随附的docker软件包不是您期望的docker软件包:

root@29a3f3134898:/# docker --version
docker - version 1.4
Copyright 2003, Ben Jansens <ben@orodu.net>

It would be easier to run a more recent Ubuntu version (where installation is as simple as sudo apt-get update && sudo apt-get install docker.io - source ), but if you need 12:04 then these instructions are from here copied here for posterity: 运行更新的Ubuntu版本会比较容易(安装就像sudo apt-get update && sudo apt-get install docker.io - source一样简单 ),但是如果您需要12:04,那么这些说明是从此处复制的这里供后人参考:

# install the backported kernel
$ sudo apt-get update
$ sudo apt-get install linux-image-generic-lts-trusty linux-headers-generic-lts-trusty

# install the backported kernel and xorg if using Unity/Xorg
$ sudo apt-get install --install-recommends linux-generic-lts-trusty xserver-xorg-lts-trusty libgl1-mesa-glx-lts-trusty

# reboot
$ sudo reboot

... ...

[ -e /usr/lib/apt/methods/https ] || {
  apt-get update
  apt-get install apt-transport-https
}
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
$ sudo sh -c "echo deb https://get.docker.com/ubuntu docker main\
> /etc/apt/sources.list.d/docker.list"
$ sudo apt-get update
$ sudo apt-get install lxc-docker

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM