SoFunction
Updated on 2025-03-09

Summary of solving the problem of docker not loading /etc/docker/file

Origin of the problem

As the question is, when installing docker on ubuntu24.04-LTS-server recently, after the installation is successful, set the source to set the mirror.
After setting the completion of the work, I will turn off the computer and use it next time.
But when I restarted, I found that the mirror was gone, but due to network problems, the mirror changed every day, and it was impossible to update the site every day to pull the mirror. So I started to check the reasons. When I find that the storage contents stored in /var/lib/docker itself have not changed.
At the same time, I also found that every time I restarted the mirror URL I set last time, I realized that the configuration file loaded by docker when I started ubuntu was not what we usually think of /etc/docker/. The solution is about to come out of joy.

Solution

Do nothing after normal restart.
1. Find your docker configuration file, there are several configuration solutions
A: Use

ps aux | grep dockerd

My results:

root        1312  2.0  1.9 2210652 75520 ?       Ssl  07:09   0:01 dockerd --group docker --exec-root=/run/ --data-root=/var/snap/docker/common/var-lib-docker --pidfile=/run// --config-file=/var/snap/docker/2963/config/
root        1415  0.2  1.8 2357832 74752 ?       Ssl  07:09   0:00 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/
user       2140  0.0  0.0   6544  2304 pts/0    S+   07:11   0:00 grep --color=auto dockerd

It turns out that I actually have --config-file=/var/snap/docker/2963/config/, which means that when my docker service starts, it is --config-file=/var/snap/docker/2963/config/ in this location instead of what we think /etc/docker/ file. But after you manually restart the configuration file in this location, it can only be said to be very strange, so I went to find the reason. So I searched online and found out that it was because of the docker package installed

B: Use the method of viewing service configuration. This method has been practiced with me, but it is operated based on the service.

systemctl show -p FragmentPath docker

Find similar configuration service files /lib/systemd/system/

cat /lib/systemd/system/ | grep ExecStart

Check the startup parameters inside. If so, you can modify them to your file and succeed. For example, /etc/docker/ file.

Reflection on the problem

When I saw the snap directory, I thought that the APT package is generally not installed there. So I asked GPT and found out that it might be because the docker-ce installed in 24.04 here is installed using a snap, but I obviously did not use snap. I guess the docker-ce used by Alibaba Source added in the tutorial is installed by snap. in the case ofaptThere should be no problem with the installation。

This is the end of this article about solving the problem of docker not loading /etc/docker/file. For more related docker not loading /etc/docker/file content, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!