Docker

How do I Find the Docker Config File?

Docker is a free, well-known, and open-source platform that is widely used to create, deliver, and process software and projects in containerized environments. Many of its advanced features are available by subscription only such as AWS ECS registry, GitHub access, and many others. But still, it’s working in free mode is stunning and provides support for different components such as Docker images, containers, Docker engine, Docker server, and Docker client. The Docker client is configured with Docker through a config file.

This article will demonstrate:

What is a Docker Config File?

The Docker config file is the main configuration file that contains all the essential configuration settings and environments to configure the Docker client with the Docker server. The Docker client is mainly used to make the interaction between Docker users and the Docker server. When the users execute any command in Docker, the Docker client interacts with dockerd or Docker daemon that carries out these commands to the Docker server.

When the Docker engine starts on Windows, it generates the “config.json” file automatically to connect the Docker client. Users can also modify the Docker config file to customize the Docker functionalities such as setting the HTTP proxy server, storage option, user settings, and many more.

How to Find the Docker Config File on Windows?

Docker users are usually required to access the configuration file of Docker to configure some additional settings. By default, the Docker config file “config.json” is placed in the “C:\Users\<username>\.docker\” directory. To access the Docker config file on Windows, follow the provided steps.

Step 1: Launch Windows File Explorer

First, launch the Start menu. Then, make the search for “File Explorer” and open it from the displayed results:

Step 2: Open “.docker” Directory From User Directory

Navigate to the “C:/User/user-name” directory and double-click on the “.docker” folder to open it:

Step 3: Find and Open “config.json” File

Next, find the “config” file with the “json” extension. Open the file in any text editor such as Notepad or VS code:

Step 4: Modify Config File in Docker

Add the essential configuration settings in JSON format according to your need and press the “CTRL+S” to save changes. For instance, we have configured the index token, log drivers, and storage driver:

{

"auths": {

"https://index.docker.io/v1/": {

"auth": "your_auth_token"

}

},

"log-driver": "json-file",

"log-level": "debug",

"storage-driver": "overlay2"

}

That’s how users can access and modify the Docker config file on Windows.

How to Find the Docker Config File on Linux Distribution?

On Linux distribution, the config.json file is not found. All the configuration settings are available in the “daemon.json” file. By default, the Docker configuration file is saved on the “/etc/docker/” path. To access the config file of Docker on Linux, follow the following demonstration.

Step 1: Open “etc/docker/” Directory

First, launch the Linux terminal. Then, execute the “cd” command to navigate to the “etc/docker/” directory:

cd /etc/docker/

Next, to view all files, execute the “ls” command:

ls

From the output, you can see that the “daemon.json” file is found in the “etc/docker/” directory:

Step 2: Open “daemon.json” Config File

Next, use a nano text editor to open and modify the Docker config file:

nano daemon.json

After that, make the essential changes and hit the “CTRL+S” to save changes. Then, exit the editor using the “CTRL+X” key:

How to Find the Docker Config File on MacOS?

By default, the “config.json” Docker config file is placed in the “.docker” directory which exists in Mac “$Home” directory. To access the “config.json” file, first, open the Mac terminal. Then, execute the “cd ~/.docker/” command:

cd ~/.docker/

That’s all about finding Docker config files on different platforms.

Conclusion

The Docker config file contains all the essential configuration settings and environment variables. It is basically used to configure Docker clients with Docker. In Windows, the Docker config file is placed on the “C:/User/username/.docker” path. On Linux, the config file is placed in the “/etc/docker” directory, and on MacOS, it is placed in the “~/.docker/” folder. This post is all about accessing a Docker config file on different operating systems.

About the author

Rafia Zafar

I am graduated in computer science. I am a junior technical author here and passionate about Programming and learning new technologies. I have worked in JAVA, HTML 5, CSS3, Bootstrap, and PHP.