ubuntu 下docker环境搭建

1、更新apt:命令 sudo apt-get update

2、安装linux-image-extra-* 包,这一步不可少,不然后面安装docker会从国外网址下载,一般被墙的下载不了, 也就安装不成功

命令:

sudo apt install linux-image-extra-$(uname -r) linux-image-extra-virtual

如果报错:

说明 linux-image-generic应该已经安装了相关的linux-image-extra包,但名称已更改为linux-modules-extra。试试这个升级到最新的内核:

sudo apt update
sudo apt upgrade
sudo apt install --reinstall linux-image-generic

然后,重新启动并尝试使用以下命令:

sudo apt install linux-modules-extra-$(uname -r) linux-image-extra-virtual 

3、安装https

 sudo apt-get install    apt-transport-https    ca-certificates    curl    software-properties-common

如果您的Ubuntu里已经有了,这步省去

4、安装GPG key

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

5、验证 key的 fingerprint 为 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88.

 sudo apt-key fingerprint 0EBFCD88

 

6、安装仓库

sudo add-apt-repository  "deb [arch=amd64] https://download.docker.com/linux/ubuntu  $(lsb_release -cs)   stable"

7、再次更新

sudo apt-get update

8、安装docker-ce,这一步我没有用国内源,所以下载很慢

sudo apt-get install docker-ce

9、上面执行完毕,docker应该算是安装完毕了,可以输入下面命令测试是否成功

 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 ID:
 https://cloud.docker.com/

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

 

 

 

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值