Skip to content

Commit

Permalink
docs(docs): docker hub 镜像加速器
Browse files Browse the repository at this point in the history
  • Loading branch information
yiliang114 committed Jun 10, 2024
1 parent 1e0c0cc commit 2df27d1
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 9 deletions.
6 changes: 2 additions & 4 deletions docs/_posts/知识库/前端/工具/本地链接服务器.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@ draft: true

### todo:

1. ssh 免密登录
2. nginx 安装
3. vscode remote 同步代码到服务器
4. travis ci 将 build 产物发送到服务器
1. vscode remote 同步代码到服务器
2. travis ci 将 build 产物发送到服务器
35 changes: 30 additions & 5 deletions docs/_posts/知识库/后台开发/工具/Nginx.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,32 @@ sudo apt-get install nginx
sudo nginx -t
```

### 证书

`/etc/nginx/conf.d` 创建自定义配置文件 `default.conf`

```nginx
server {
listen 80;
listen 443 ssl;
server_name domain www.domain;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
ssl on;
ssl_certificate /etc/nginx/ssl/cert.cer;
ssl_certificate_key /etc/nginx/ssl/cert.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4:!DH:!DHE;
ssl_prefer_server_ciphers on;
error_page 497 https://$host$uri?$args;
}
```

### Linux -bash: rz(或者是 sz): command not found

```
Expand Down Expand Up @@ -427,8 +453,7 @@ https://www.jianshu.com/p/fe0fadb38600

配置

```shell

```nginx
#user nobody;
worker_processes 1;
Expand Down Expand Up @@ -469,9 +494,9 @@ http {
ssl_certificate_key server.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
location / {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
title: 'Docker Hub 镜像国内加速'
date: '2024-06-10'
tags:
- docker
---

# Docker Hub 镜像国内加速

## 1. 配置加速地址

创建或修改 `/etc/docker/daemon.json`

```shell
mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": [
"https://dockerproxy.com",
"https://docker.mirrors.ustc.edu.cn",
"https://docker.nju.edu.cn"
]
}
EOF
systemctl daemon-reload
systemctl restart docker
```

## 2. 可用列表

1. `https://registry.docker-cn.com/`
1. `https://docker.m.daocloud.io/`
1. `https://dockerproxy.com/`
1. `https://mirror.baidubce.com/`
1. `https://docker.nju.edu.cn/`
1. `https://mirror.iscas.ac.cn/`
1. ...

## 3. 检查加速器是否生效

```shell
docker info
```

输出中会看到类似下面的内容:

```
...
Registry Mirrors:
https://registry.docker-cn.com/
https://docker.m.daocloud.io/
https://dockerproxy.com/
https://mirror.baidubce.com/
https://docker.nju.edu.cn/
https://mirror.iscas.ac.cn/
...
```

0 comments on commit 2df27d1

Please sign in to comment.