简介:
ubuntu安装很简单,就直接放操作了。
附加:快速搭建各种漏洞环境(Various vulnerability environment) https://github.com/Medicean/VulApps
ubuntu16.4或18.4前期的源和系统准备可以参照:https://blog.csdn.net/lm2017/article/details/101985812
操作:
1.删除原先的docker(默认没有)
sudo apt-get remove docker docker-engine docker.io containerd runc
2.添加 Docker 的官方 GPG 密钥
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
3.验证您现在是否拥有带有指纹的密钥
sudo apt-key fingerprint 0EBFCD88
4.设置稳定版仓库
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
5. 安装最新的Docker-ce
sudo apt-get update
sudo apt-get install docker-ce
6.apt-get install docker-ce可能会出现的问题,无问题直接跳过
可能会发生下面的提示:
无法获得锁 /var/lib/dpkg/lock - open (11: 资源暂时不可用)
无法锁定管理目录(/var/lib/dpkg/),是否有其他进程正占用它?
解决办法如下:
(1)终端输入 ps aux ,列出进程。找到含有apt-get的进程,直接sudo kill PID。(应该会kill把)
(2)强制解锁,命令
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock
完成后重新 sudo apt-get install docker-ce
7.配置docker镜像加速
sudo curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://d1c9c786.m.daocloud.io
sudo systemctl restart docke
问题附加:
1.用Hello World校验Docker的安装
sudo docker run hello-world
如果出现Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
d1725b59e92d: Pull complete
不要慌,服务器从Docker Hub获取到最新的Hello World镜像,下载到本地。
再次输入docker run hello-world,回车:
Hello from Docker.
This message shows that your installation appears to be working correctly.
2.Error response from daemon: Get https://registry-1.docker.io/v2/: x509: certificate is valid for drivefca.com, www.drivefca.com, not registry-1.docker.io(20200403更新问题)
或者提示
sudo vim /etc/docker/daemon.json(若没有自行创建)
写入:
{
"registry-mirrors": [
"http://hub-mirror.c.163.com"
],
"insecure-registries": [
"registry-1.docker.io"
]
}
最终重启一下docker:
sudo systemctl daemon-reload
sudo systemctl restart docker