Vagrant+Docker搭建开发环境踩坑记录

安装Docker和Docker-Compose

国内有墙,一开始通过

# install some tools
sudo yum install -y git vim gcc glibc-static telnet bridge-utils kernel-devel

# install docker
curl -fsSL get.docker.com -o get-docker.sh
sh get-docker.sh

安装总是下载不下来文件

解决方案:
DaoCloud

Vagrant实现本地文件和虚拟机文件共享

修改syncFolder

config.vm.synced_folder "./", "/vagrant_data"
vagrant up

报错

Vagrant was unable to mount VirtualBox shared folders. This is usually
because the filesystem “vboxsf” is not available. This filesystem is
made available via the VirtualBox Guest Additions and kernel module.
Please verify that these guest additions are properly installed in the
guest. This is not a bug in Vagrant and is usually caused by a faulty
Vagrant box. For context, the command attempted was:

mount -t vboxsf -o uid=1000,gid=1000 home_vagrant_labs /home/vagrant/labs

The error output from the command was:

mount: unknown filesystem type ‘vboxsf’

解决方案:

vagrant plugin install vagrant-vbguest

但是——之后 vagrant up 就一直停在了yum install 下载依赖上
网上一番查找原因,是因为没有为虚拟机安装增强功能的原因
参考:https://jingyan.baidu.com/article/84b4f565579a7660f6da32b5.html

之后虽然VBoxLinuxAddition安装成功,但是却提示缺少kernel-headers
又安装相关依赖

yum update kernel -y

yum install kernel-headers kernel-devel gcc make -y

重启之后还是提示没有找到kernel-headers
几次尝试没有解决

就又

vagrant up
config.vm.synced_folder "./", "/vagrant_data"

最后测试可以实现同步

大部分时间浪费在了国内墙、问题定位、日志查看上

你可能感兴趣的:(填坑指南)