前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >1.Ubuntu安装docker准备篇

1.Ubuntu安装docker准备篇

作者头像
友儿
发布2022-09-11 13:01:06
3710
发布2022-09-11 13:01:06
举报
文章被收录于专栏:友儿友儿

Linux安装docker

首先用vagrant创建一个新的虚拟机。这里不在过多说明,有需要请移步这篇文章<<Mac上下载安装Vagrant、配置打包属于自己的开发环境(使用Homestead后续也会更新出来)>> 这里简单粗略的贴一下创建过程

代码语言:javascript
复制
zhengniu@Mac vagrant % mkdir docker2 && cd docker2  # 创建一个新的文件夹并且进入文件夹
zhengniu@Mac docker2 % vagrant box list  #列出当前所有Box              
docker_ubuntu (virtualbox, 0)
ub2020        (virtualbox, 0)
ubuntu1606    (virtualbox, 0)
zhengniu@Mac docker2 % vagrant box add docker2 ../box/ubuntu1606.box #添加一个名称为docker2的Box
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'docker2' (v0) for provider:
    box: Unpacking necessary files from: file:///Users/zhengniu/Downloads/study/vagrant/box/ubuntu1606.box
==> box: Successfully added box 'docker2' (v0) for 'virtualbox'!        
zhengniu@Mac docker2 % vagrant init docker2  #初始化一个新VM 即虚拟机
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
zhengniu@Mac docker2 % ls #生成一个配置文件
Vagrantfile
zhengniu@Mac docker2 % sudo vi Vagrantfile #修改配置文件
Password:  

找到这个行,把注释去掉 config.vm.network "private_network", ip: "192.168.33.12" #打开配置设置静态IP (和主机保持在同一网段)

代码语言:javascript
复制
zhengniu@Mac docker2 % vagrant up # 启动虚拟机
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'docker2'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: docker2_default_1599362376454_99012
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection reset. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default:
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default:
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default:
    default: Guest Additions Version: 5.1.38
    default: VirtualBox Version: 6.0
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
    default: /vagrant => /Users/zhengniu/Downloads/study/vagrant/docker2   #与主机默认的共享目录
 
    zhengniu@Mac docker2 % vagrant ssh # 进入创建的虚拟机
    Welcome to Ubuntu 16.04.6 LTS (GNU/Linux 4.4.0-161-generic x86_64)
     * Documentation:  https://help.ubuntu.com
     * Management:     https://landscape.canonical.com
     * Support:        https://ubuntu.com/advantage
    0 packages can be updated.
    0 updates are security updates.
    New release '18.04.5 LTS' available.
    Run 'do-release-upgrade' to upgrade to it.
    vagrant@ubuntu-xenial:~$
本文参与?腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

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

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

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

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
容器服务
腾讯云容器服务(Tencent Kubernetes Engine, TKE)基于原生 kubernetes 提供以容器为核心的、高度可扩展的高性能容器管理服务,覆盖 Serverless、边缘计算、分布式云等多种业务部署场景,业内首创单个集群兼容多种计算节点的容器资源管理模式。同时产品作为云原生 Finops 领先布道者,主导开源项目Crane,全面助力客户实现资源优化、成本控制。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
http://www.vxiaotou.com