admin管理员组文章数量:1646247
前言
本次实验使用的操作系统镜像为 ubuntu-18.04.2-desktop
第一步 安装操作系统
1.1 软件下载
使用官方提供的 Ubuntu 18.04.2 Desktop 镜像,下载地址:https://ubuntu/download
1.2 软件安装
此步骤省略
1.3 登录后输入以下命令,切入到 root 用户
rsecc@rsecc:~$ sudo -i
[sudo] password for rsecc:
第二步 Docker 安装
2.1 安装必要的系统工具
root@rsecc:~# apt-get update
root@rsecc:~# apt-get -y install apt-transport-https ca-certificates curl software-properties-common
2.2 安装 GPG 证书
root@rsecc:~# curl -fsSL https://mirrors.aliyun/docker-ce/linux/ubuntu/gpg | apt-key add -
2.3 写入软件源信息
root@rsecc:~# add-apt-repository "deb [arch=amd64] https://mirrors.aliyun/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
2.4 更新并安装 Docker-CE
root@rsecc:~# apt-get -y update
root@rsecc:~# apt-get -y install docker-ce
2.5 启动 docker 并设置开机自启
root@rsecc:~# systemctl start docker
root@rsecc:~# systemctl enable docker
2.6 测试
root@rsecc:~# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
0e03bdcc26d7: Pull complete
Digest: sha256:7f0a9f93b4aa3022c3a4c147a449bf11e0941a1fd0bf4a8e6c9408b2600777c5
Status: Downloaded newer image for hello-world:latest
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/
For more examples and ideas, visit:
https://docs.docker/get-started/
第三章 配置 Docker 镜像加速器
3.1 修改或创建 daemon 配置文件 /etc/docker/daemon.json 来使用加速器
root@rsecc:~# mkdir -p /etc/docker
root@rsecc:~# tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://registry.docker-cn"]
}
EOF
3.2 重启 daemon 和 Docker
root@rsecc:~# systemctl daemon-reload
root@rsecc:~# systemctl restart docker
3.3 检查加速器是否生效
root@rsecc:~# docker info
……省略……
Registry Mirrors:
https://registry.docker-cn/
Live Restore Enabled: false
附录
Docker 镜像加速列表
Docker 中国官方镜像:https://registry.docker-cn
科大镜像站:https://docker.mirrors.ustc.edu
阿里云:https://<your_code>.mirror.aliyuncs
[需要注册,获取专属的镜像加速链接]
七牛云:https://reg-mirror.qiniu
华为云:https://<your_code>.mirror.swr.myhuaweicloud
[需要注册,获取专属的镜像加速链接]
腾讯云:https://mirrors.tencentyun
版权声明:本文标题:Docker 安装及镜像加速器配置 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/dongtai/1729415721a1200240.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论