首页 文章 精选 留言 我的

精选列表

搜索[部署],共10000篇文章
优秀的个人博客,低调大师

Newbe.McrMirror 官方加速现已部署

更新内容 全系列最新补丁已经更新:包含 2.1, 3.1, 5.0 最近,我们注意到,微软官方已经将在中国区建立相关加速的 issue 关闭了https://github.com/microsoft/containerregistry/issues/7。 因此,正常来说,现在开发者直接拉取 mcr 镜像应该已经得到了加速。但是,我们仍然得到了部分用户的反馈,表示效果不佳。 故而,我们还将继续保持该项目的更新,为中国大陆开发者使用 MCR 镜像带来更好的体验。 使用方法 存在至少三种方法进行加速: 使用 docker-mcr (推荐) 拉取国内服务器上的镜像 使用 DockerHub 加速器 注意,无论采用什么方式,请先确保本地的 docker 已经正常可用。 使用 docker-mcr docker-mcr 是一个 dotnet core global tool,简单几步,便可以进行安装和使用。 进入 dotnet 页面,下载并安装 netcore 3.1 或 5 SDK。 安装完毕后打开控制台运行以下命令: dotnet tool install newbe.mcrmirror -g 现在,假如需要拉取 mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim ,则运行以下命令: docker-mcr -i mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim 等待完成之后,便可以在本地看到已经拉取完毕的镜像。 如果您曾经安装过 newbe.mcrmirror ,您需要使用以下命令来进行升级,确保最佳的体验。 dotnet tool update newbe.mcrmirror -g 拉取国内服务器上的镜像 加速的本质是因为我将镜像推送到了国内的服务器,目前在以下服务器均存在镜像: 阿里云 registry.cn-hangzhou.aliyuncs.com/newbe36524 假设需要拉取 aspnet:5.0-buster-slim 点击此处打开配置文件,搜索 mcr.microsoft.com/dotnet/core/aspnet:5.0-buster-slim 会找到以下节点 { "tag": "aspnet:5.0-buster-slim", "source": "mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim" } 则说明在国内镜像的 tag 为 aspnet:5.0-buster-slim。 则拼接上面的前缀,则得到地址 registry.cn-hangzhou.aliyuncs.com/newbe36524/aspnet:5.0-buster-slim 然后,为了不修改默认的 Dockerfile 您可以运行以下命令: docker pull registry.cn-hangzhou.aliyuncs.com/newbe36524/aspnet:5.0-buster-slim docker tag registry.cn-hangzhou.aliyuncs.com/newbe36524/aspnet:5.0-buster-slim mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim 这样你就成功的在本地得到了 mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim 镜像。 当然,你也可以直接把 registry.cn-hangzhou.aliyuncs.com/newbe36524/aspnet:5.0-buster-slim 写入到你的 Docker file 中。 使用 DockerHub 加速器 我也将镜像推送到了 dockerhub ,所以正常来说,在中国大陆使用 dockerhub 加速器也可以达到加速的效果。 规则,mcr.microsoft.com/dotnet/{name}:{tag} -> newbe36524/{name}:{tag} 例如,您可以运行以下命令: docker pull newbe36524/aspnet:5.0-buster-slim docker tag newbe36524/aspnet:5.0-buster-slim mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim 这样你就成功的在本地得到了 mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim 镜像。 当然,你也可以直接把 newbe36524/aspnet:5.0-buster-slim 写入到你的 Docker file 中。 在此之前,请确保你正确配置了本地的加速器。

优秀的个人博客,低调大师

Harbor1.9 部署并配置https

为什么要使用https协议 因为不用 https 协议的话,docker 客户端需要修改配置,如果 docker 客户端多的话配置起来就很麻烦。 版本信息 OS:CentOS Linux 7.6 Release Docker:18.09.6 Docker-compose:1.24.1 Harbor:harbor-offline-installer-v1.9.0 IP:172.0.0.11 1. 安装docker 1.1 配置repository: yum install -y yum-utils device-mapper-persistent-data lvm2 yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo 1.2 安装最新版本docker-ce yum install -y docker-ce 1.3 配置docker加速 参考docker.hub:https://www.daocloud.io/mirror curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io systemctl restart docker.service 1.4 启动docker: systemctl start docker systemctl enable docker 2. 安装docker-compose 2.1 下载二进制文件 curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose 如果需要安装其他版本的话,请修改上面命令中的版本号。 2.2 赋予二进制文件可执行权限 chmod +x /usr/local/bin/docker-compose ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose 2.3 根据自己的情况决定是否安装命令补全功能 yum install -y bash-completion curl -L https://raw.githubusercontent.com/docker/compose/1.24.1/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose 2.4 测试是否安装成功 docker-compose --version 3. harbor开启https 如果使用 1.8 或者 1.9 版本,切记配置文件中 https 需要顶格,证书和 port 需要缩进相同单位,不然会报错。 3.1 创建 ca 证书 mkdir -p /data/cert cd /data/cert 3.2 生成 CA 的 key cd /data/cert openssl genrsa -out ca.key 4096 3.3 生成 CA 的 crt cd /data/cert openssl req -x509 -new -nodes -sha512 -days 3650 \ -subj "/C=CN/ST=Beijing/L=Beijing/O=chinatelecom/OU=ecloudcaas/CN=172.0.0.11" \ -key ca.key \ -out ca.crt 3.4 生成自己域名的 key cd /data/cert openssl genrsa -out 172.0.0.11.key 4096 3.5 生成自己域名的 csr cd /data/cert openssl req -sha512 -new \ -subj "/C=CN/ST=Beijing/L=Beijing/O=chinatelecom/OU=ecloudcaas/CN=172.0.0.11" \ -key 172.0.0.11.key \ -out 172.0.0.11.csr 3.6 生成一个 openssl 命令需要的外部配置文件 主要是subjectAltName,这里写的IP.1=yourip还可以写DNS.1=yourdomainname cd /data/cert cat > v3.ext <<-EOF authorityKeyIdentifier=keyid,issuer basicConstraints=CA:FALSE keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment extendedKeyUsage = serverAuth subjectAltName = @alt_names [alt_names] IP=172.0.0.11 EOF 3.7 通过 ext 和 csr 生成 crt cd /data/cert openssl x509 -req -sha512 -days 3650 \ -extfile v3.ext \ -CA ca.crt -CAkey ca.key -CAcreateserial \ -in 172.0.0.11.csr \ -out 172.0.0.11.crt 3.8 将服务端的 crt 转换成客户端用的 cert cd /data/cert openssl x509 -inform PEM -in 172.0.0.11.crt -out 172.0.0.11.cert 3.9 将带域名的 cert,key 和 ca.crt 拷贝到 docker client 所在主机的 /etc/docker/certs.d/yourdomain/ 目录下 mkdir -p /etc/docker/cert/172.0.0.11 cp /data/cert/172.0.0.11.cert /etc/docker/cert/172.0.0.11/ cp /data/cert/172.0.0.11.key /etc/docker/cert/172.0.0.11/ cp /data/cert/ca.crt /etc/docker/cert/172.0.0.11/ 3.10 创建 /etc/docker/daemon cat > /etc/docker/daemon.json << EOF { "insecure-registries":["http://172.0.0.11"] } EOF 3.11 重启 docker systemctl daemon-reload systemctl restart docker 4. 安装 Harbor 4.1 下载 harbor 离线包 mkdir -p /home/harbor/ wget -P /home/harbor/ https://storage.googleapis.com/harbor-releases/release-1.9.0/harbor-offline-installer-v1.9.0.tgz cd /home/harbor/ tar xf harbor-offline-installer-v1.9.0.tgz cd /home/harbor/harbor cp harbor.yml harbor.yml.bak 4.2 修改配置文件 其他地方不修改,只改以下几处: cd /home/harbor/harbor/ [root@harbor harbor]# egrep -v "^#|^$" harbor.yml|grep -v "#" https: port: 443 certificate: /home/harbor/cert/172.0.0.11.crt private_key: /home/harbor/cert/172.0.0.11.key 4.3 更新参数 cd /home/harbor/harbor/ ./prepare 4.4 安装 cd /home/harbor/harbor/ ./install 4.5 查看 Harbor 的日常运维管理是通过 docker-compose 来完成的,Harbor 本身有多个服务进程,都放在 docker 容器之中运行,可以通过 docker ps 或者 docker-compose 来查看: cd /home/harbor/harbor/ [root@harbor harbor]# docker-compose ps Name Command State Ports ---------------------------------------------------------------------------------------------------------------------------------------------- harbor-adminserver /harbor/start.sh Restarting harbor-core /harbor/start.sh Up (health: starting) harbor-db /entrypoint.sh postgres Up (healthy) 5432/tcp harbor-jobservice /harbor/start.sh Up harbor-log /bin/sh -c /usr/local/bin/ ... Up (healthy) 127.0.0.1:1514->10514/tcp harbor-portal nginx -g daemon off; Up (healthy) 80/tcp nginx nginx -g daemon off; Up (healthy) 0.0.0.0:443->443/tcp, 0.0.0.0:4443->4443/tcp, 0.0.0.0:80->80/tcp redis docker-entrypoint.sh redis ... Up 6379/tcp registry /entrypoint.sh /etc/regist ... Up (healthy) 5000/tcp registryctl /harbor/start.sh Up (healthy) [root@harbor harbor]# 5. 网页登录和创建项目 在浏览器输入: https://172.0.0.11; 默认账号密码: admin / Harbor12345; 创建一个项目:os; 6. 镜像的推送 6.1 下载官方的 centos 镜像 docker pull centos:7.4.1708 6.2 修改 TAG docker tag centos:7.4.1708 172.0.0.11/os/centos:7.4.1708 docker images | grep centos 172.0.0.11/os/centos 7.4.1708 3afd47092a0e 2 months ago 197MB centos 7.4.1708 3afd47092a0e 2 months ago 197MB 6.3 命令行登录 harbor cat > /etc/docker/daemon.json << EOF { "insecure-registries":["http://172.0.0.11"] } EOF systemctl daemon-reload systemctl restart docker [root@harbor harbor]# docker login 172.0.0.11 Username: admin Password: Harbor12345 WARNING! Your password will be stored unencrypted in /root/.docker/config.json. Configure a credential helper to remove this warning. See https://docs.docker.com/engine/reference/commandline/login/#credentials-store Login Succeeded 6.4 推送镜像到harbor(需要login) docker push 172.0.0.11/os/centos:7.4.1708 6.5 在 harbor 中查看 7. 镜像的拉取 假设是一台没有登录此 harbor 的 docker 客户端 7.1 创建 /etc/docker/daemon.json 文件 { "registry-mirrors": ["https:mirror.ccs.tencentyun.com","https://kuamavit.mirror.aliyuncs.com", "https://registry.docker-cn.com", "https://docker.mirrors.ustc.edu.cn"], "insecure-registries" : ["http://172.0.0.11"], "max-concurrent-downloads": 10, "log-driver": "json-file", "log-level": "warn", "log-opts": { "max-size": "10m", "max-file": "3" } } 7.2 重启Docker生效 systemctl daemon-reload systemctl restart docker 7.3 拉取 harbor 中的镜像 docker login 172.0.0.11 docker pull 172.0.0.11/os/centos:7.4.1708

资源下载

更多资源
腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

用户登录
用户注册