在 VMware 虚拟机中的 CentOS 7 内安装 docker machine

环境

CentOS Linux release 7.5.1804

安装docker-machine

base=https://github.com/docker/machine/releases/download/v0.14.0 &&
  curl -L $base/docker-machine-$(uname -s)-$(uname -m) >/tmp/docker-machine &&
  sudo install /tmp/docker-machine /usr/local/bin/docker-machine

docker-machine -v

安装 virtualbox

将ol7_addons(Oracle Linux的源)添加到yum源

cat << EOF | sudo tee /etc/yum.repos.d/ol7_addons.repo
[ol7_addons]
name=Oracle Linux $releasever Add ons (\$basearch)
baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL7/addons/\$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1
EOF
# Verify this manually if you're paranoid like me
sudo rpm --import http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol7
sudo yum makecache

安装VirtualBox

yum -y install VirtualBox-5.2
yum -y install kernel-devel kernel-devel-3.10.0-693.el7.x86_64

查看系统内核版本

➜  ~ uname -sr
Linux 3.10.0-862.el7.x86_64

ftp://ftp.riken.jp/Linux/cern/centos/7/updates/x86_64/repoview/kernel-devel.html
下载并安装指定的版本

wget ftp://ftp.riken.jp/Linux/cern/centos/7/updates/x86_64/Packages/kernel-devel-3.10.0-862.el7.x86_64.rpm
yum -y install kernel-devel-3.10.0-862.el7.x86_64.rpm

更新

sudo /sbin/vboxconfig

创建 default machine

创建名为default的machine

docker-machine create --driver virtualbox default

如果提示

Error with pre-create check: "This computer doesn't have VT-X/AMD-v enabled. Enabling it in the BIOS is mandatory"

则需要关闭虚拟机,在VMware设置中开启虚拟化
VMware 配置

博客更新地址

说点什么

  Subscribe  
提醒