docker容器介绍(三)连载

国内镜像源

去查看如何使用aliyun的docker镜像库
去查看如何使用网易蜂巢的docker镜像库----作业,并且通过网易蜂巢源下载一个nginx的镜像---docker  pull  镜像仓库与镜像名字
daocloud.io

Docker 加速器

使用 Docker 的时候,需要经常从官方获取镜像,但是由于显而易见的网络原因,拉取镜像的过程非常耗时,严重影响使用 Docker 的体验。因此 DaoCloud 推出了加速器工具解决这个难题,通过智能路由和缓存机制,极大提升了国内网络访问 Docker Hub 的速度。
​
Docker 加速器对 Docker 的版本有要求吗?    
需要 Docker 1.8 或更高版本才能使用。
​
Docker 加速器支持什么系统?    
Linux, MacOS 以及 Windows 平台。
​
Docker 加速器是否收费?    
提供永久免费的加速器服务,请放心使用。

国内比较好的镜像源:网易蜂巢、aliyun和daocloud

daocloud.io--官网

===========以下为亲测================

使用国内镜像:

进入网站:https://daocloud.io/

注册帐号:xxxx

进入镜像市场

随便选择一个,选择mysql

上面有详细的使用命令。但是每个镜像的命令不一样,在选择一个:

[root@yixuan ~]# docker pull daocloud.io/library/nginx   #下载镜像
Using default tag: latest
latest: Pulling from library/nginx
0a4690c5d889: Pull complete 
9719afee3eb7: Pull complete 
44446b456159: Pull complete 
Digest: sha256:f83b2ffd963ac911f9e638184c8d580cc1f3139d5c8c33c87c3fb90aebdebf76
Status: Downloaded newer image for daocloud.io/library/nginx:latest
daocloud.io/library/nginx:latest

现在我们使用web界面管理docker容器:

等一会,不要手动终止:

[root@yixuan ~]# curl -sSL https://get.daocloud.io/daomonit/install.sh | sh -s 8e6d8ce76e4ec4668f31859dae6297439ac49243 
 * Installing Daomonit...
 * Downloading Daomonit from https://get.daocloud.io/daomonit/daomonit.x86_64.rpm
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   279  100   279    0     0   1091      0 --:--:-- --:--:-- --:--:--  1094
100   337  100   337    0     0    950      0 --:--:-- --:--:-- --:--:--   950
100 3349k  100 3349k    0     0  2060k      0  0:00:01  0:00:01 --:--:-- 2207k
准备中...                          ################################# [100%]
正在升级/安装...
   1:daomonit-0.1.70-1                ################################# [100%]
Created symlink from /etc/systemd/system/multi-user.target.wants/daomonit.service to /usr/lib/systemd/system/daomonit.service.
 * Configuring Daomonit...
[10/04/19 23:05:51] [DEBG] Writing configuration file /etc/daocloud/daomonit.yml
[10/04/19 23:05:51] [INFO] You have successfully saved your config file.
 * Start Daomonit...
Starting daomonit (via systemctl):                         [  OK  ]
​
You can view daomonit log at /var/log/daomonit.log
And You can Start or Stop daomonit with: service daomonit start/stop/restart/status
​
*********************************************************************
*********************************************************************
***
***  Installed and Started Daomonit 0.1.70
***
***  NOTICE: 
***  You can pull image very Fast by dao, For Example: 
***     dao pull ubuntu
***
*********************************************************************
*********************************************************************
[root@yixuan ~]# 

完成之后:

点击查看主机

启动我们的容器

[root@yixuan ~]# docker images   #查看镜像
REPOSITORY                              TAG                 IMAGE ID            CREATED             SIZE
daocloud.io/library/nginx               latest              98ebf73aba75        2 months ago        109MB
daocloud.io/daocloud/daocloud-toolset   latest              bbdc71e950ea        2 years ago         147MB
​
[root@yixuan ~]# docker run -it daocloud.io/library/nginx /bin/bash   #运行容器
root@37b8b8cdd75f:/#

将容器启动之后刷新一下刚才的界面点击容器就会显示出来

点击查看详情...

配置阿里云的镜像仓库

创建阿里云的私有仓库

使用自己的私有仓库

登录:
[root@yixuan ~]# docker login --username=xuan2504 registry.cn-shanghai.aliyuncs.com
Password: 
...
Login Succeeded
重新打标记
[root@yixuan ~]# docker tag daocloud.io/library/nginx:latest registry.cn-shanghai.aliyuncs.com/testpm/nginx:1.1
上传到自己的仓库
[root@yixuan ~]# docker push registry.cn-shanghai.aliyuncs.com/testpm/nginx:1.1
The push refers to repository [registry.cn-shanghai.aliyuncs.com/testpm/nginx]
be91fceb796e: Layer already exists 
919b6770519b: Layer already exists 
b60e5c3bcef2: Layer already exists 
1.1: digest: sha256:6b3b6c113f98e901a8b1473dee4c268cf37e93d72bc0a01e57c65b4ab99e58ee size: 948

查看上传的镜像

自己的nginx:1.1版本已经上传成功!

使用自己的仓库

使用阿里的仓库下载镜像:
删除镜像
[root@yixuan ~]# docker rmi registry.cn-shanghai.aliyuncs.com/testpm/nginx:1.1
Untagged: registry.cn-shanghai.aliyuncs.com/testpm/nginx:1.1
Untagged: registry.cn-shanghai.aliyuncs.com/testpm/nginx@sha256:6b3b6c113f98e901a8b1473dee4c268cf37e93d72bc0a01e57c65b4ab99e58ee
​
从自己的仓库下载
[root@yixuan ~]# docker pull registry.cn-shanghai.aliyuncs.com/testpm/nginx:1.1
1.1: Pulling from testpm/nginx
Digest: sha256:6b3b6c113f98e901a8b1473dee4c268cf37e93d72bc0a01e57c65b4ab99e58ee
Status: Downloaded newer image for registry.cn-shanghai.aliyuncs.com/testpm/nginx:1.1
registry.cn-shanghai.aliyuncs.com/testpm/nginx:1.1
​
查看
[root@yixuan ~]# docker images 
REPOSITORY                                                               TAG                 IMAGE ID            CREATED             SIZE
registry.cn-shanghai.aliyuncs.com/testpm/nginx                           1.1                 e791337790a6        4 weeks ago         127MB

配置阿里加速器:
如果这个目录/etc/docker/不存在就创建
[root@yixuan ~]# vim /etc/docker/daemon.json
{
  "registry-mirrors": ["https://br003st4.mirror.aliyuncs.com"]
}
[root@yixuan ~]# systemctl daemon-reload
[root@yixuan ~]# systemctl restart docker

猜你喜欢

转载自blog.csdn.net/qfyangsheng/article/details/108258928