离线安装docker

       最近在调试docker,搜索网上的资料,很多都是在线安装,按照步骤来,总是不成功,然后那些文章根本就没有任何出错的说明以及解决,没得法了,只能在docker的官网上看,主要还是因为不想看英文,最后还是得看!(官网上的详细安装步骤链接https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-docker-ce),这个是在Ubuntu下安装,其它的可以在网页的左边表单里找。如果按照这些步骤还是出现问题,有两个主要原因,一个是因为网络的问题(公司局域网,只能使用一台代理电脑上网,同时很多人使用这个代理,导致更新过程中有比较大的延迟,所以经常会更新失败),一个就是镜像源,复杂点我也不深究,难得搞。然后就是使用离线安装,官网中也有写。

       离线安装,主要需要下载安装包,链接在这https://download.docker.com,找到你自己需要的对应的系统的版本,因为我使用的是Ubuntu16.04,所以直接选择linux,跟着目录一层层进去(/linux/ubuntu/dist/),然后选择xenial(关于这个,是根据ubuntu对不同版本的命名,xenial就是指16.04LTS,trusty是14.04,artful是17.10,bionic是18.04),接着就是pool/stable,然后根据处理器的不同,选择相应的目录,进了目录下载一个版本(随意哪个都可以),接下来就是在Ubuntu中安装了.

        sudo dpkg -i /path/pakage.deb

        其中path是离线安装包在你本机的目录,pakage.deb就是你下载的包的名字,把这些替换成真实的就可以了,最后

        sudo docker run hello-world

        如果出现以下信息:

        Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.
To try something more ambitious, you can run an Ubuntu container with:

 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/

For more examples and ideas, visit: https://docs.docker.com/engine/userguide/

就说明安装成功!(上一条命令,是在docker官方镜像库中下载了hello-world的镜像,所以要保证网络通畅,不然是无法下载镜像,那么运行就会报错)

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值