Error Message:
Can’t install homeassistant/amd64-addon-matter-server:7.0.0: 500 Server Error for http+docker://localhost/v1.41/images/create?tag=7.0.0&fromImage=homeassistant%2Famd64-addon-matter-server&platform=linux%2Famd64: Internal Server Error (“Get “https://registry-1.docker.io/v2/”: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)”)
Issues like this are usually caused by inability to access the Docker source. Especially in mainland China, we can solve this by setting up a Docker request proxy.
Prerequisites:
You need a proxy service that can access registry-1.docker.io, such as the proxy service provided by Clash at http://192.168.0.150:7890 (remember to enable Clash’s “allow connect from Lan” option).
Solutions
Supervised Version
Log in to Debian
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo nano /etc/systemd/system/docker.service.d/http-proxy.conf
Fill in the content:
# File: /etc/systemd/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=xx.xx.xx.xx:port"
Environment="HTTPS_PROXY=xx.xx.xx.xx:port"
Environment="NO_PROXY=localhost,127.0.0.1"
Restart:
sudo reboot
After restarting, the problem of installing add-ons should be resolved. If your proxy address is temporary, remember to comment out the proxy address configuration after completing the add-on installation.
HAOS
Since HAOS has a read-only file system, you cannot directly modify or create the /etc/systemd/system/docker.service.d/http-proxy.conf file. Therefore, we create the file in the writable /mnt/data/ folder in HAOS, then mount the folder to /etc/ using mount --bind.
There might be a problem here: the /etc/systemd/system/docker.service.d/ folder does not exist by default in the system, and due to the read-only file system, you cannot create the corresponding folder, so you cannot directly mount the file to /etc/systemd/system/docker.service.d/http-proxy.conf. Here we use a tricky method to bypass this problem: first copy all contents of the /etc/systemd/system/ folder to /mnt/data/docker/systemd/system/, then mount the entire /mnt/data/docker/systemd/system/ directory to /etc/systemd/system/. This way, the content of /mnt/data/docker/systemd/system/docker.service.d/http-proxy.conf can be mounted to /etc/systemd/system/docker.service.d/http-proxy.conf.
Here are the command lines:
ha> login
mkdir -p /mnt/data/docker/systemd/system/docker.service.d
cp -R /etc/systemd/system/* /mnt/data/docker/systemd/system/
vi /mnt/data/docker/systemd/system/docker.service.d/http-proxy.conf
Fill in the content:
# File: /mnt/data/docker/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=xx.xx.xx.xx:port"
Environment="HTTPS_PROXY=xx.xx.xx.xx:port"
Environment="NO_PROXY=localhost,127.0.0.1"
mount --bind /mnt/data/docker/systemd/system/ /etc/systemd/system/
systemctl daemon-reload
systemctl restart docker
docker start homeassistant
Since mounting via mount --bind is a temporary action, the proxy configuration will be reset after you restart HAOS after solving the problem.