Not recommended in Chinese mainland network environments.
Integrates installation of Docker Engine and Docker Compose, supports selecting or switching software repositories (Docker repositories) 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.
Not recommended in Chinese mainland network environments.
Completely replace the official installation script
It is logically consistent with get.docker.com and incorporates the repositories and features of this project.
Supports domestic derivative operating systems
Compatible with a number of derivative operating systems not supported by the official installation script.
Powerful and unparalleled
One of the most practical open source operation and maintenance scripts on the entire network, with excellent performance
Exquisite interactive design
An interactive command line interface that is easy to understand and use, way ahead of the competition
✨ After years of technical accumulation and production environment testing, it has been widely praised by the community and deeply loved by developers. It is used by major companies.
Docker Compose does not require a separate installation
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.
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 some force majeure, Docker Hub is currently inaccessible in the Chinese mainland network environment, so the image cannot be pulled normally. It is recommended to use the image warehouse source available in Chinese mainland mentioned 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.
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 Chinese mainland may still not be able to access Docker Hub.
You can also specify multiple registry mirrors, e.g., SOURCE_REGISTRY='"https://example.registry.com","https://test.registry.com"', separated by commas.
This option can be used to control the compatibility of the installed software package (only applicable to Red Hat operating systems). For details, see the path name (positive integer) representing the version number in the corresponding warehouse directory.
Red Hat Enterprise LinuxCentOSRocky LinuxAlmaLinuxFedoraopenEulerOpenCloudOSAnolis OS
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).
This feature is introduced to facilitate the use of developers and operation and maintenance personnel. After it is enabled, the script content output will be simplified. It is recommended to use it with other command options without interaction.
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.
If it prompts that it is not supported, please use the system's own package management tool to install it. Because these packages are built and maintained by the Linux distribution's package maintainers and may have differences in configuration or are built from modified source code.
The project also provides a simplified version, which is a copy of the main script, designed for enterprise products and large open-source community projects. It has the following features:
Single display language English, no I18n internationalization
Uses the official source by default, removing the interactive selection of built-in software sources
# !/bin/bashfunctioninstall_docker(){ifcommand-vdocker&>/dev/null;thenreturnfi# script optionslocalscript_host="linuxmirrors-8bw.pages.dev"# official host (CDN), more host see official sitelocalclose_firewall="true"# close firewalld service and selinux (redhat systems need)# mirrors optionslocalsource_docker_ce_address="mirrors.tencent.com/docker-ce"# global high availability addresslocalsource_docker_ce_protocol="https"# https or httplocalsource_docker_registry_address="registry.hub.docker.com"# judge network environmentlocalregion_code="$(curl-sipinfo.io/country)"if[["${region_code}"=="CN"]];thenlocalsource_intranet_address=""# use intranet source if possibleif[-s"/sys/class/dmi/id/sys_vendor"];thenlocalsys_vendor="$(cat/sys/class/dmi/id/sys_vendor)"if[["${sys_vendor}"==*"Alibaba"*]];thensource_intranet_address="mirrors.cloud.aliyuncs.com/docker-ce"elif[["${sys_vendor}"==*"Huawei"*]];thensource_intranet_address="mirrors.myhuaweicloud.com/docker-ce"elif[["${sys_vendor}"==*"Tencent"*]];thensource_intranet_address="mirrors.tencentyun.com/docker-ce"elif[["${sys_vendor}"==*"Inspur"*]];thensource_intranet_address="mirrors.ivolces.com/docker-ce"fielsecat/etc/motd|grep"Alibaba Cloud "-q
if[$?-eq0];thensource_intranet_address="mirrors.cloud.aliyuncs.com/docker-ce"fifi# check connectivityif[-n"${source_intranet_address}"];thenifping-c1-W1"${source_intranet_address%%/*}">/dev/null2>&1;thensource_docker_ce_address="${source_intranet_address}"source_docker_ce_protocol="http"fifi# registry mirror (best choice for Chinese mainland)source_docker_registry_address="docker.1ms.run"else# use official sourcesource_docker_ce_address="download.docker.com"source_docker_registry_address="registry.hub.docker.com"fi# install docker enginebash<(curl-sSLhttps://${script_host}/docker-lite.sh)\--source"${source_docker_ce_address}"\--source-registry"${source_docker_registry_address}"\--protocol"${source_docker_ce_protocol}"\--close-firewall"${close_firewall}"}install_docker
# !/bin/bashfunctioninstall_docker(){ifcommand-vdocker&>/dev/null;thenreturnfibash<(curl-sSLhttps://${script_host}/docker.sh)\--install-latesttrue\--ignore-backup-tips\--langauto
ifcommand-vdocker&>/dev/null;thenecho-e"\n# Docker installation successful.\n# Please run this script again manually after installation."exit0elseecho-e"\n# Docker installation failed.\n# Please check the error message above."exit1fi}install_docker
Note: If you don't specify Docker CE and Docker Registry mirrors, the script will be interactively selected by the user. The screen will be automatically cleared ($ clear) at this point, which will cause your script's log to be cleared.