Docker common configuration related issues

Docker common configuration related issues

Docker is easy to learn


1. What is Docker?

Docker is a technology that enables applications to be packaged in any environment. The packaged thing is called an image.

2. Where is the Docker configuration file placed and how to modify the configuration?

The configuration file for systems using systemd (such as Ubuntu 16.04, Centos, etc.) is in /etc/docker/daemon.json.

3. How to change the default storage location of Docker?

The default storage location of Docker is /var/lib/docker. If you want to store Docker's local files in other partitions, you can use a Linux soft connection to complete it, or specify it through the -g parameter when starting the daemon, or modify the configuration file The "data-root" entry in /etc/docker/daemon.json. You can use docker system info | grep "Root Dir" to see the current storage location in use.

docker system info | grep "Root Dir"

4. When using memory and swap limits to start a container, a warning is reported: Limitation discarded?

Error details

”WARNING: Your kernel does not support cgroup swap limit. WARNING: Your kernel does not support swap limit capabilities. Limitation discarded.”

This is because the system does not enable the 在这里插入代码片statistics , and the introduction of this function will bring performance degradation. To turn on this feature, you can do the following:

  • Edit /etc/default/grub file (Ubuntu system as an example), configure GRUB_CMDLINE_LINUX=“cgroup_enable=memory swapaccount=1”
  • 更新 grub:$ sudo update-grub
  • Just restart the system.

5. Configure image acceleration?

For systems using systemd, write the following in /etc/docker/daemon.json

{
    
    
  "registry-mirrors": [
    "https://registry.docker-cn.com"
  ]
}

or use the command

mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
    
    
  "registry-mirrors": ["<your accelerate address>"]
}

reboot

sudo systemctl daemon-reload
sudo systemctl restart docker

6. What are the domestic acceleration sites?

The default storage location of Docker is /var/lib/docker. If you want to store Docker's local files in other partitions, you can use a Linux soft connection to complete it, or specify it through the -g parameter when starting the daemon, or modify the configuration file The "data-root" entry in /etc/docker/daemon.json. You can use docker system info | grep "Root Dir" to see the current storage location in use.

https://registry.docker-cn.com

http://hub-mirror.c.163.com

https://3laho3y3.mirror.aliyuncs.com

http://f1361db2.m.daocloud.io

https://mirror.ccs.tencentyun.com


Summarize

Don't be afraid if you encounter Docker problems, write it down, and forget it next time

Hope this blog will be useful to you. I am the King of Light, and I speak for myself.

Guess you like

Origin blog.csdn.net/moer0/article/details/123141703