Cloud Native 6 min read

Install Docker & Docker‑Compose Offline in 30 Seconds on Any Linux Server

This guide shows how to set up Docker Engine and Docker‑Compose on isolated Linux machines without internet access by downloading static binaries, transferring them, and running a ready‑made Bash script that configures, starts, and verifies the installation in just a few steps.

Xiao Liu Lab
Xiao Liu Lab
Xiao Liu Lab
Install Docker & Docker‑Compose Offline in 30 Seconds on Any Linux Server

Many production servers operate in air‑gapped environments such as finance, government, or industrial edge devices, where direct internet access is prohibited but container workloads are still required. Installing Docker and Docker‑Compose offline can be challenging, yet it is essential for running and orchestrating containers securely.

Step 1 – Download the required packages on a connected machine

# Docker static package (includes dockerd, containerd, runc)
wget https://download.docker.com/linux/static/stable/x86_64/docker-24.0.7.tgz

# Docker Compose binary for Linux
wget https://github.com/docker/compose/releases/download/v2.23.0/docker-compose-linux-x86_64 -O docker-compose

# Alternative source if the above fails (provided by 小柳实验室)
wget https://download.xlsys.cn/docker/compose/v2.32.0/docker-compose-linux-x86_64

If you need an ARM64 build (e.g., Kunpeng or Raspberry Pi), replace the x86_64 part of the URL with aarch64.

Step 2 – Transfer the files to the offline server

Copy the downloaded docker-*.tgz archive and the docker-compose binary (no file extension) to a directory on the target host, for example /opt/docker-offline/. Use any available method such as scp, rsync, or ftp.

Step 3 – Run the offline installation script

chmod +x install_docker_compose_offline.sh
sudo bash install_docker_compose_offline.sh

The script automatically:

Installs the Docker engine and starts the service.

Installs Docker‑Compose, makes it executable, and places it in /usr/local/bin.

Verifies the installation by printing docker --version and docker-compose --version.

Leaves the system ready to launch containers with docker-compose up -d.

Full offline installation script (Docker + Compose)

#!/bin/bash
set -e

# ==================== Configuration ====================
OFFLINE_PKG_DIR="/opt/docker-offline"
# =====================================================

RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'

log(){ echo -e "${GREEN}[INFO]${NC} $1"; }
warn(){ echo -e "${YELLOW}[WARN]${NC} $1"; }
error(){ echo -e "${RED}[ERROR]${NC} $1" >&2; exit 1; }

detect_os(){
  if [ -f /etc/os-release ]; then
    . /etc/os-release
    OS=$ID
    VERSION=$VERSION_ID
  else
    error "Unable to detect operating system"
  fi
  case "$OS" in
    ubuntu|debian) PKG_MANAGER="apt" ;;
    centos|rhel|rocky|almalinux) PKG_MANAGER="yum" ;;
    *) error "Unsupported OS: $OS" ;;
  esac
  log "Detected OS: $OS $VERSION"
}

# (The rest of the script continues with extraction, installation, and validation.)

Usage tips: On ARM64 hosts, download the docker-compose-linux-aarch64 binary and ensure it has no file extension and is executable. Adjust OFFLINE_PKG_DIR if you store the packages elsewhere.

By following these three steps, you can move from an online one‑click Docker installer to a fully offline, rapid deployment workflow, making container technology simpler, safer, and more accessible in restricted environments.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

DockerLinuxcontainerDocker Composeoffline installation
Xiao Liu Lab
Written by

Xiao Liu Lab

An operations lab passionate about server tinkering 🔬 Sharing automation scripts, high-availability architecture, alert optimization, and incident reviews. Using technology to reduce overtime and experience to avoid major pitfalls. Follow me for easier, more reliable operations!

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.