跳到主要内容

配置代理

配置代理

清除镜像源,然后参考 deepseek 给出的示例:

sudo mkdir -p /etc/systemd/system/docker.service.d

sudo tee /etc/systemd/system/docker.service.d/proxy.conf <<-'EOF'
[Service]
Environment="HTTP_PROXY=http://proxy.example.com:8080"
Environment="HTTPS_PROXY=http://proxy.example.com:8080"
Environment="NO_PROXY=localhost,127.0.0.1,.internal"
EOF

sudo systemctl daemon-reload
sudo systemctl restart docker

效果测试

search、pull、push全部可用。

ubuntu@HomeLab:~$ docker search mysql
NAME DESCRIPTION STARS OFFICIAL
mysql MySQL is a widely used, open-source relation… 15658 [OK]
bitnami/mysql Bitnami container image for MySQL 130
circleci/mysql MySQL is a widely used, open-source relation… 31
cimg/mysql 3
bitnamicharts/mysql Bitnami Helm chart for MySQL 0
ubuntu/mysql MySQL open source fast, stable, multi-thread… 67
linuxserver/mysql A Mysql container, brought to you by LinuxSe… 41
google/mysql MySQL server for Google Compute Engine 25
elestio/mysql Mysql, verified and packaged by Elestio 1
docksal/mysql MySQL service images for Docksal - https://d… 0
alpine/mysql mysql client 3
mysql/mysql-server Optimized MySQL Server Docker images. Create… 1026
jumpserver/mysql 1
datajoint/mysql MySQL image pre-configured to work smoothly … 2
mysql/mysql-router MySQL Router provides transparent routing be… 28
ilios/mysql Mysql configured for running Ilios 1
mirantis/mysql 0
corpusops/mysql https://github.com/corpusops/docker-images/ 0
mysql/mysql-cluster Experimental MySQL Cluster Docker images. Cr… 100
vulhub/mysql 1
mysql/mysql-operator MySQL Operator for Kubernetes 1
vitess/mysql Lightweight image to run MySQL with Vitess 1
nasqueron/mysql 1
cbioportal/mysql This repository hosts MySQL database images … 0
encoflife/mysql 0

ubuntu@HomeLab:~$ docker pull mysql
Using default tag: latest
latest: Pulling from library/mysql
43759093d4f6: Pull complete
d255dceb9ed5: Pull complete
23d22e42ea50: Pull complete
431b106548a3: Pull complete
2be0d473cadf: Pull complete
f56a22f949f9: Pull complete
277ab5f6ddde: Pull complete
df1ba1ac457a: Pull complete
cc9646b08259: Pull complete
893b018337e2: Pull complete
Digest: sha256:146682692a3aa409eae7b7dc6a30f637c6cb49b6ca901c2cd160becc81127d3b
Status: Downloaded newer image for mysql:latest
docker.io/library/mysql:latest

所有操作需遵守《中华人民共和国网络安全法》及相关法规,禁止非法跨境传输数据。