Loading [MathJax]/jax/output/CommonHTML/config.js
前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >2019-06-02 在MAC系统上通过Vagrant 安装 CentOS 并在虚拟机上安装docker

2019-06-02 在MAC系统上通过Vagrant 安装 CentOS 并在虚拟机上安装docker

作者头像
Albert陈凯
发布于 2019-06-03 00:36:04
发布于 2019-06-03 00:36:04
93800
代码可运行
举报
文章被收录于专栏:Albert陈凯Albert陈凯
运行总次数:0
代码可运行

实在搞不定可以用https://labs.play-with-docker.com/ 来玩玩就好了。

今天我打算练习docker,但还不影响MacOS的纯净性 计划使用虚拟机的方式进行练习,

结构如下,Mac -> vagrant -> VirtualBox Cent 7 -> Docker

这样做的目的是实验环境随时可一键删除,不影响使用的系统,

隔离了用户系统的影响,

不管是windows 还是 Mac 得到的演示结果是一致的

首先下载必要的软件

VirtualBox

https://www.virtualbox.org/wiki/Downloads

Vagrant

https://www.vagrantup.com/downloads.html

找到自己操作系统的版本

下载安装就不在这里详述了

打开终端工具执行命令 验证vagrant是否安装成功
代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
AlbertMP:~ Albert$ vagrant
Usage: vagrant [options] <command> [<args>]

    -v, --version                    Print the version and exit.
    -h, --help                       Print this help.

Common commands:
     box             manages boxes: installation, removal, etc.
     cloud           manages everything related to Vagrant Cloud
     destroy         stops and deletes all traces of the vagrant machine
     global-status   outputs status Vagrant environments for this user
     halt            stops the vagrant machine
     help            shows the help for a subcommand
     init            initializes a new Vagrant environment by creating a Vagrantfile
     login
     package         packages a running vagrant environment into a box
     plugin          manages plugins: install, uninstall, update, etc.
     port            displays information about guest port mappings
     powershell      connects to machine via powershell remoting
     provision       provisions the vagrant machine
     push            deploys code in this environment to a configured destination
     rdp             connects to machine via RDP
     reload          restarts vagrant machine, loads new Vagrantfile configuration
     resume          resume a suspended vagrant machine
     snapshot        manages snapshots: saving, restoring, etc.
     ssh             connects to machine via SSH
     ssh-config      outputs OpenSSH valid configuration to connect to the machine
     status          outputs status of the vagrant machine
     suspend         suspends the machine
     up              starts and provisions the vagrant environment
     upload          upload to machine via communicator
     validate        validates the Vagrantfile
     version         prints current and latest Vagrant version
     winrm           executes commands on a machine via WinRM
     winrm-config    outputs WinRM configuration to connect to the machine

For help on any individual command run `vagrant COMMAND -h`

Additional subcommands are available, but are either more advanced
or not commonly used. To see all subcommands, run the command
`vagrant list-commands`.

下面开始用vagrant安装centOS7

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
# 创建一个目
mkdir -p ~/coding/docker/centos7
# 移动到当前目录
cd ~/coding/docker/centos7
# 查看当前目录
   pwd
# 初始化一个centos/7
  vagrant init centos/7
# 查看Vagrant 配置
 more Vagrantfile
# 启动
  vagrant up
# 登陆刚刚创建好了的 centos
  vagrant ssh

安装docker

https://docs.docker.com/install/linux/docker-ce/centos/#prerequisites

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
1  hostname
    2  ip addr
    3  exit
    4  ll
    5  sudo yum update
    6  exit
    7  sudo yum remove docker                   docker-client                   docker-client-latest                   docker-common                   docker-latest                   docker-latest-logrotate                   docker-logrotate                   docker-engine
    8  sudo yum install -y yum-utils   device-mapper-persistent-data   lvm2
    9  sudo yum-config-manager     --add-repo    https://download.docker.com/linux/centos/docker-ce.repo
   10  sudo yum install docker-ce docker-ce-cli containerd.io
   15  sudo systemctl start docker
   16  sudo docker run hello-world
   17  history

至此Docker就安装完成了

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2019.06.02 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
暂无评论
推荐阅读
编辑精选文章
换一批
笔记:win10上快速搭建容器环境,不需要VM
1.5.1 在Win10上准备centos7 和大家说明一下,我们的目的仅仅是要安装一个centos7,然后在centos7上安装docker 如果搞不定vagrant+virtualbox的方式,也可以直接使用VM搭建一个centos7 或者你可以直接使用一台云服务器,上面安装了centos7 毕竟我们的目的只是为了得到一个centos7的机器,所以不必花太多精力在这个问题上折腾 我上课用的环境是 【 win10 64位 VirtualBox-6.0.12-133076-Win
源码之路
2020/12/01
5780
『中级篇』在centos上安装docker(九)
在mac和window上都已经安装了docker,这次咱们在linux系统下安装docker。这次也补充下vagrant如何搜索:Vagrantfile 如何搜Vagrantfile 之前的课程已经已
IT架构圈
2018/06/27
7550
Docker实战 (二) - Docker环境的搭建方法
sudo apt-get remove docker docker-engine docker.io 安装所需仓库
JavaEdge
2019/02/15
6610
Docker实战 (二) - Docker环境的搭建方法
『中级篇』docker-Machine的本地使用(十)
https://docs.docker.com/machine/get-started-cloud/
IT架构圈
2018/06/04
8100
Docker在各种操作系统环境的下载、安装配置方法
b. 通过其完全限定的包名称安装特定版本,包名称(docker-ce)加上版本字符串(第2列)直到第一个连字符,用连字符( - )分隔,例如,docker-ce-18.03.0.ce.
JavaEdge
2021/02/23
1.3K0
Docker在各种操作系统环境的下载、安装配置方法
基于vagrant+VirtualBox快速搭建虚拟机
下载 VirtualBox 和Vagrant ,并安装 为什么我们要选择Vagrant呢?因为它有跨平台、可移动、自动化部署无需人工参与等优点。 VirtualBox 安装 VirtualB
咻一咻
2020/05/29
1.3K0
Centos7 使用Minikube安装kubernetes
dashboard管理后台是kubernetes提供的容器管理后台,可以用来进行机器负载,集群管理,镜像扩展,配置参数等相关操作
Linux运维技术之路
2022/06/07
1.2K0
Centos7 使用Minikube安装kubernetes
vagrant学习笔记 - 基本命令的使用
box多版本共存的情况 如果box升级过,那么在box list中会出现两个同名,但版本不同的镜像。如:
pollyduan
2019/11/04
1.3K0
windows 安装vagrant reload 失败; No Virtualbox Guest Additions installation found.[通俗易懂]
问题描述:已经安装vagrant-vbguest 插件,且版本为0.30,使用的box 为centos7
全栈程序员站长
2022/07/19
5550
windows 安装vagrant reload 失败; No Virtualbox Guest Additions installation found.[通俗易懂]
如何在 CentOS 8 上安装 Vagrant
Vagrant是一个命令行工具,用于构建和管理虚拟开发环境。默认情况下,Vagrant 在 VirtualBox, Hyper-V, 和 Docker 之上准备环境。支持其他提供者,例如, Libvirt (KVM), VMware and AWS 可以通过 Vagrant 插件系统启用。
雪梦科技
2020/05/11
9450
如何在 CentOS 8 上安装 Vagrant
CentOS7安装Docker遇到的问题笔记
以下是笔者本人学习搭建docker过程当中记录的一些实践笔记,过程当中也遇到了一些坑,但都解决了,就此记录,留作以后再次搭建时可以直接参考。
朱季谦
2021/09/26
9901
Vagrant安装Docker及Docker上安装Redis并设置密码
具体详情大家可以参考官网:http://www.docker-cn.com/what-container#/virtual_machines]()
猫老师的叶同学
2023/03/01
6890
『中级篇』如何在mac上通过vagrant安装虚拟机(七)
PS:虽然可以在window和mac下直接安装docker来进行学习,但是对于实际的环境来说虚拟机的方式可以减轻电脑的硬盘负担,也更容易来删除方便控制。
IT架构圈
2018/06/01
1.4K0
Docker、Docker Compose安装
Docker 安装 # 卸载老版本Docker sudo yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ do
嘉美伯爵
2021/01/18
1.1K0
TF实战丨使用Vagrant安装Tungsten Fabric
双路E5-2860v3 CPU,24核48线程,128G DDR4 ECC内存,NVME盘 512G。
Tungsten Fabric
2020/06/18
1K0
TF实战丨使用Vagrant安装Tungsten Fabric
k8s 系列教程-Vagrant
vagrant是开源的虚拟机技术,相对于 vmware 而言更轻量级,操作更简便移植性更强,如果我们需要学习k8s或者搭建一些集群的话建议使用 Virtualbox+Vagrant。Vagrant 是创建虚拟机的工具,Virtualbox 是vagrant 管理工具,而且这两个软件是开源的,不需要我去付费或者破解。掌握 Vagrant技术对我们后续学习k8s会有很大的帮助
六个核弹
2022/12/23
8090
『中级篇』docker企业版本地安装之UCP(57)
PS:详细不介绍,就是一个图形化的,没啥介绍的。下次在阿里平台是建立下用云端玩玩。
IT架构圈
2018/09/28
6470
VirtualBox + Vagrant 安装 CentOS7 虚拟机
https://www.virtualbox.org/wiki/Downloads
程序员飞飞
2020/04/08
2.3K0
一步步学KubeVirt CI (5) - Vagrant
CentOS Stream 9已经装了vagrant和virtualBox,提示不支持当前的linux内核,竟然不支持当前内核。virtualBox官网看了,只有最高到Centos Stream 8的版本,算了,virtualBox + vagrant就改在windows下跑吧。
后端云
2022/11/25
1.1K0
一步步学KubeVirt CI (5) - Vagrant
Mac下vagrant从安装到体验
Mac下使用虚拟机时,通过vagrant+virtualbox的组合是个不错的方案,简便快捷;
程序员欣宸
2019/08/29
1.8K0
Mac下vagrant从安装到体验
相关推荐
笔记:win10上快速搭建容器环境,不需要VM
更多 >
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
本文部分代码块支持一键运行,欢迎体验
本文部分代码块支持一键运行,欢迎体验