×


Solve docker error loading config file

We have helped to resolve numerous Docker issues for our customers as part of our Linux Server Support Services.

In this context, we shall look into the reason why this error occurs and how to solve it.

Why does docker error loading config file occurs?

This error is as a result of an empty "config.json" file in the Docker container. It usually displays the error as presented below when you run a docker command with sudo permission;

WARNING: Error loading config file: /home/user/.docker/config.json -
stat /home/user/.docker/config.json: permission denied


How to get rid of docker error loading config file

From the error message above, you can see that the directory ".docker" does not have the right permission when created. This can be quickly fixed by changing the .docker directory's permission with the following command;

sudo chown "$USER":"$USER" /home/"$USER"/.docker -R
sudo chmod g+rwx "$HOME/.docker" -R


Note that "$USER" represents the username of the current directory which the user is using.

If the above does not work, you can simply move the directory to remove the directory created with insufficient permissions.

Alternatively, you can also fix this error by adding curly braces {} to the config.json file which is located in the .docker directory. After saving the file, restart the docker daemon with the following command;

sudo systemctl restart docker


Need Support in solving Docker errors? Reach us Today.

Conclusion

Docker error loading config file signifies that there is an issue loading docker configuration file "config.json" while trying to start the docker instance.