181 words
1 minute
Installing Docker & Docker Compose(China)
This guide covers both online and air-gapped (offline) installation methods for Docker and Docker Compose on Linux systems. It is intended for users who need to deploy in restricted intranet environments or environments without external internet access.
π Online Installation
Method 1: Official Script & Manual Compose Download
curl -fsSL https://get.docker.com -o get-docker.shshget-docker.shsudo apt-get install libffi-dev libssl-devγcurl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-composesudo chmod +x /usr/local/bin/docker-composeMethod 2: Using Mirror Scripts (Optimized for specific regions)
bash <(curl -sSL https://linuxmirrors.cn/docker.sh)π¦ Offline Installation (Air-gapped)
- Download Binaries Download the required packages on a machine with internet access:
# Docker Static Binarywget https://download.docker.com/linux/static/stable/x86_64/docker-24.0.6.tgz
# Docker Compose Binarywget https://github.com/docker/compose/releases/download/1.29.2/docker-compose-Linux-x86_64- Extract and Install Docker Transfer the files to the target machine, then execute:
tar -xvzf docker-24.0.6.tgzsudo cp docker/* /usr/bin/- Configure Systemd Service Create a service unit file to manage the Docker daemon:
sudo tee /etc/systemd/system/docker.service > /dev/null <<EOF[Unit]Description=Docker Application Container EngineAfter=network.target
[Service]ExecStart=/usr/bin/dockerdRestart=always
[Install]WantedBy=multi-user.targetEOF
# Reload configuration and enable the servicesudo systemctl daemon-reloadsudo systemctl enable dockersudo systemctl start docker- Install Docker Compose
sudo mv docker-compose-Linux-x86_64 /usr/local/bin/docker-composesudo chmod +x /usr/local/bin/docker-compose- Verify Installation
docker -vdocker-compose -v Installing Docker & Docker Compose(China)
https://fuwari.vercel.app/posts/ec661856-ac41-4faa-9c35-33405bb802b1/ This content has been translated with the assistance of AI tools, including ChatGPT, Gemini, and Qwen. While efforts have been made to ensure accuracy and clarity, minor discrepancies may exist. Please refer to the original text for authoritative interpretation if needed.