暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

使用脚本一键安装Docker

stormMoonlet 2020-12-12
716


一叶知秋



注意:Linux中安装Ubuntu Server 16.04详细步骤参考如下:https://blog.csdn.net/qq_41614359/article/details/100942951

ISO映像文件链接地址

链接:https://pan.baidu.com/s/1K_0vNarXFlS_IPvf2sLxBA 提取码:2x5r 复制这段内容后打开百度网盘手机App,操作更方便哦

小月亮


Ubuntu 16.04 +

Ubuntu 16.04 + 上的 Docker CE 默认使用 overlay2 存储层驱动,无需手动配置。


使用脚本自动安装

在测试或开发环境中 Docker 官方为了简化安装流程,提供了一套便捷的安装脚本,Ubuntu 系统上可以使用这套脚本安装:

$ curl -fsSL get.docker.com -o get-docker.sh
# 可能会出现 404 错误,请移步下面的特别说明
$ sudo sh get-docker.sh --mirror Aliyun

执行这个命令后,脚本就会自动的将一切准备工作做好,并且把 Docker CE 的 Edge 版本安装在系统中。


启动 Docker CE

$ sudo systemctl enable docker
$ sudo systemctl start docker


测试 Docker 是否安装正确

$ docker run hello-world


Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
ca4f61b1923c: Pull complete
Digest: sha256:be0cd392e45be79ffeffa6b05338b98ebb16c87b255f48e297ec7f98e123905c
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://cloud.docker.com/


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

若能正常输出以上信息,则说明安装成功。


Docker镜像加速

对于使用 systemd的系统,请在 /etc/docker/daemon.json 中写入如下内容(如果文件不存在请新建该文件

{
"registry-mirrors": [
"https://registry.docker-cn.com"
]
}

注意,一定要保证该文件符合 json 规范,否则 Docker 将不能启动。

之后重新启动服务。

$ sudo systemctl daemon-reload
$ sudo systemctl restart docker

检查加速器是否生效

配置加速器之后,如果拉取镜像仍然十分缓慢,请手动检查加速器配置是否生效,在命令行执行 docker info,如果从结果中看到了如下内容,说明配置成功。

Registry Mirrors:
https://registry.docker-cn.com/
文章转载自stormMoonlet,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论