Docker 系列之 Linux 下安装篇

0x00:
网上有许多中文教程看了甚不满意。还是看官方教程好
地址:Debian Linux
Ps: 本教程仅仅是对官方教程的翻译
docker 需要Linux Kernels 大于 3.10 并且是 64-bit 机器。如果不达标自己想办法吧~
0x01: check
1.RUN:

$ uname -r
4.0.0-kali1-amd64

显示基带版本。达标~~继续下一步

打开终端:
2.sudo 或者 su 以下命令:

vim /etc/apt/sources.list.d/backports.list

vim 创建并打开backports.list 若已经存在则重新编辑:
加入

deb http://http.debian.net/debian wheezy-backports main
#紧接着刷新源
 $ apt-get update

0x02:
好了,下一步!
3.同样的必须以管理员(root)权限运行以下命令:

#删除所有旧版本docker

$ apt-get purge lxc-docker*
$ apt-get purge docker.io*

#可能没有旧版本(之前没有安装过)

$ apt-get update  #惯例 刷新源。。

接下来:
4.确认apt 添加了https 方法 和 CA certificates

$ apt-get install apt-transport-https ca-certificates

5.添加一个新的GPG key

$ apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

6 编辑/etc/apt/sources.list.d/docker.list 文件
若已经存在请清空文件后继续

vim /etc/apt/sources.list.d/docker.list 

加入 这3 条中的一条。请参照debian系统对应加入

#On Debian Wheezy
deb https://apt.dockerproject.org/repo debian-wheezy main
#On Debian Jessie
deb https://apt.dockerproject.org/repo debian-jessie main
#On Debian Stretch/Sid
deb https://apt.dockerproject.org/repo debian-stretch main

刷新:

 $ apt-get update

7 确认正确安装repository

 $ apt-cache policy docker-engine

8 正式安装!

$ sudo apt-get update

$ sudo apt-get install docker-engine

# 安装结束 打开 docker服务
$ sudo service docker start

# 验证安装
$ 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.
 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 Hub account:
 https://hub.docker.com

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


  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值