Home  >  Article  >  Operation and Maintenance  >  How to change the image warehouse in docker

How to change the image warehouse in docker

王林
王林Original
2020-04-14 13:11:435706browse

How to change the image warehouse in docker

After Docker is installed, its official image warehouse is used by default. However, this warehouse is not very friendly to domestic developers and is very slow. Therefore, we need to change this before officially using docker. The default image repository.

1. Modify the file /etc/docker/daemon.json (if the file does not exist, you can create it directly) and fill in the following content:

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

How to change the image warehouse in docker

2. Restart the Docker service. You need to confirm that the restart is successful.

systemctl restart docker # 重启docker服务
systemctl status docker  # 确认docker服务正常运行

3. Confirm that the new mirror warehouse configuration is successful.

docker info

From the printed information, find the option "Registry Mirrors" , confirm that it is the address of the mirror warehouse we configured. If it is not or does not have this option, it means that the configuration of the mirror warehouse failed and needs to be done again!

Recommended tutorial: docker tutorial

The above is the detailed content of How to change the image warehouse in docker. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn