Other Tools
Widely used by many popular projects and highly praised by the community
Docker Installation & Mirror Switching Script#
![]() |
|
![]() |
|
![]() |
![]() |
![]() |
|
![]() |
One-Click Execution Command#
Real-time sync, no delay. Recommended for use in mainland China network environments.
This project has joined the GitHub acceleration plan, with a 1-hour sync delay.
Integrates installation of Docker Engine
and Docker Compose
, supports selecting or switching software sources and registry mirrors, installing specific versions, reinstalling, and supports ARM architecture.
The script refers to the official documentation and uses the system package manager for installation. There are no compatibility or security issues. The available versions are determined by the Docker CE repository.
bash <(curl -sSL https://gitee.com/SuperManito/LinuxMirrors/raw/main/DockerInstallation.sh) --only-registry
Real-time sync, no delay. Recommended for use in mainland China network environments.
bash <(curl -sSL https://raw.gitcode.com/gh_mirrors/li/LinuxMirrors/raw/main/DockerInstallation.sh) --only-registry
This project has joined the GitHub acceleration plan, with a 1-hour sync delay.
About Software Sources
-
Docker CE Software Repository
Docker CE stands for Docker Community Edition, which is another name for Docker Engine. This repository is used to download and install Docker-related packages.
-
Docker Registry Mirror
Used to control the default source repository for pulling images, also known as a registry accelerator. The default is the official container registry Docker Hub.
Due to certain uncontrollable factors, Docker Hub is generally inaccessible in mainland China, making it impossible to pull images. It is recommended to use the domestic registry mirrors listed below.
Note: The specified WEB protocol in the script is only for controlling the Docker CE
software source. Docker Registry
always uses the HTTPS
protocol.
Docker Compose no longer needs to be installed separately
Starting from V2, Docker Compose is part of the Docker CLI. The script integrates the installation of this plugin by default. Please use the docker compose
command instead of docker-compose
.
Built-in Registry Mirrors
Site Name | Address | Description |
---|---|---|
1ms Mirror | docker.1ms.run | Enterprise mirror, CDN smart distribution, extremely fast, supports paid customization, recommended |
Docker Proxy | dockerproxy.net | Created by ghproxy, highly available but slow, supports paid enterprise acceleration |
DaoCloud | docker.m.daocloud.io | Well-known enterprise mirror, highly available and fast, now whitelist only |
1Panel Mirror | docker.1panel.live | Enterprise product self-use mirror |
This open source project is not suitable for collecting personal self-built registry accelerators. If needed, you can use command options to specify your own.
Note: Registry mirrors from domestic cloud computing companies are only for their own business. Instances in mainland China may still not be able to access Docker Hub.
-
Command Options (Advanced Usage)#
Name Meaning Value --source
Specify Docker CE
source address (domain or IP)address
--source-registry
Specify registry mirror address (domain or IP) address
--branch
Specify Docker CE repository repo name (see docs below)
--codename
Specify Debian-based OS codename codename
--designated-version
Specify Docker CE
installation versionversion (see docs below)
--protocol
Specify WEB protocol for Docker CE
sourcehttp
orhttps
--install-latest
Whether to install the latest Docker Engine true
orfalse
--close-firewall
Whether to disable the firewall true
orfalse
--clean-screen
Whether to clear the screen before running true
orfalse
--only-registry
Only switch registry mirror mode none --ignore-backup-tips
Ignore backup overwrite prompt (do not backup) none --pure-mode
Pure mode, minimal output none Full source format:
<WEB protocol>://<source address (domain or IP)>/<repository path>
-
Specify Docker CE Source Address#
Note: The address path must include the Docker CE repository path, i.e.,
docker-ce
. -
Specify Registry Mirror Address#
-
Only Switch Registry Mirror#
Only switches the registry accelerator. If Docker is not installed, an error will be reported and exit.
-
Install the
jq
package -
Specify registry mirror address
Manually replace
<example.registry.com>
with the registry address. See the address column in the "Built-in Registry Mirrors" table above.SOURCE_REGISTRY='"https://example.registry.com","https://test.registry.com"'
, separated by commas. -
Replace registry mirror address
-
Restart Docker service
-
-
Specify Docker CE Repository#
The script will automatically detect this in most cases. Specify only if you have special requirements.
Repository names are fixed:
centos
,debian
,fedora
,raspbian
,rhel
,sles
,static
,ubuntu
See official installation docs and Docker CE official repo for details. -
Specify Docker CE Installation Version#
When specifying a version, the "install latest" option is ignored. Format:
major.minor.patch
, e.g.,27.4.1
.If the specified version does not exist or is not supported on your system, the script will report an error and exit.
How to view available versions
Versions not listed are not supported by this script. If you cannot get the version list, your system environment has not been properly configured for the Docker CE repository (this will not happen when running the script).
-
Unattended (Automation)#
To perform installation without interaction, use at least the following options. Recommended for experienced users.
Example Commandbash <(curl -sSL https://linuxmirrors.cn/docker.sh) \ --source mirror.example.com/docker-ce \ --source-registry registry.hub.docker.com \ --protocol http \ --use-intranet-source false \ --install-latest true \ --close-firewall true \ --ignore-backup-tips
If you get an "invalid option" error, check the option validity and whitespace encoding. Each option is written on a separate line for readability.
-
Pure Mode#
This feature is for developers. When enabled, script output is minimized. Recommended for use with other options in non-interactive mode.
Scrolling command logs may have unpredictable display issues, but no problems have been found so far.
-
-
About Service Startup Errors#
In non-fresh environments, you may encounter
Docker
service startup failures after running the script. It is recommended to reinstall to resolve this. Uninstalling will not delete local images or container data.Uninstall commands:
After uninstalling, simply rerun the script to install.