docker configuration file

/etc/docker/daemon.json file function

/etc/docker/daemon.jsonThe file is a Docker configuration file that configures the behavior and parameters of the Docker daemon. The Docker daemon is a background process responsible for managing and running Docker containers. By modifying daemon.jsonfiles, you can perform various configurations and settings on the Docker daemon.

The functions of this configuration file include but are not limited to:

  1. Image accelerator settings: You can set the image accelerator through the configuration registry-mirrorsfield to speed up pulling Docker images, especially in domestic network environments.

  2. Unsafe registries:insecure-registries You can specify untrusted Docker image registry addresses through the field, allowing Docker clients to pull images from these registries.

  3. Log configuration: You can configure the log behavior of the Docker daemon, including the output location, format, level, etc. of the log.

  4. Network settings: You can configure the network behavior of the Docker daemon, such as the default network bridging method, DNS resolver, etc.

  5. Storage driver: You can configure the default storage driver of the Docker daemon, such as overlay2, aufs, etc.

  6. Resource limits: You can configure resource limits for the Docker daemon, such as CPU and memory limits.

  7. Security settings: You can configure the security-related settings of the Docker daemon, such as whether to enable experimental features, the default container runtime, etc.

  8. Remote access: You can configure whether the Docker daemon allows remote access and specify the listening address and port.

In summary, daemon.jsonfiles allow users to customize the behavior and configuration of the Docker daemon to suit specific needs and environments. After modifying the configuration, you usually need to restart the Docker daemon process for the configuration to take effect.

systemctl daemon-reload

systemctl daemon-reloadis a command for systemd that reloads the systemd daemon's configuration files.

When you modify the configuration file of the systemd service (usually located /etc/systemd/system/in the directory) and want these modifications to take effect, you need to run systemctl daemon-reloadthe command.

The function of this command is to notify systemd to reload its configuration file so that the new configuration takes effect. After modifying the configuration, running this command ensures that systemd uses the updated configuration the next time it starts or operates related services.

Note that systemctl daemon-reload the service will not be restarted, it will just reload the configuration file . If you wish to apply the new configuration and restart the service, you can run systemctl restart 服务名the command, where "servicename" is the name of the systemd service you want to restart.

sudo systemctl restart docker

Restart the docker service through the systemd service (of course, the configuration file changes in the docker service /etc/docker/daemon.jsonwill take effect)

Guess you like

Origin blog.csdn.net/Ternence_zq/article/details/132204900