You can directly download and install Docker binary files. This method is useful when the network environment is limited or when you want to avoid specific dependencies.
Download the latest version of the Docker binaries from the official Docker GitHub repository:
mkdir -p /usr/local/bin
cd /usr/local/bin
curl -L https://download.docker.com/linux/static/stable/x86_64/docker-20.10.23.tgz -o docker.tgz
tar xzvf docker.tgz
rm docker.tgz
Grant execution permissions to the downloaded binary files:
chmod +x docker/*
Add the Docker command to the system path:
ln -s /usr/local/bin/docker/docker /usr/bin/docker
ln -s /usr/local/bin/docker/docker-proxy /usr/bin/docker-proxy
To register Docker as a service, create a systemd service file:
sudo vi /etc/systemd/system/docker.service
Add the following content:
[Unit]
Description=Docker Application Container Engine
After=network.target
[Service]
Type=notify
ExecStart=/usr/local/bin/docker/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=infinity
LimitNPROC=infinity
TimeoutStartSec=0
Delegate=yes
KillMode=process
[Install]
WantedBy=multi-user.target
Start the service and set it to run automatically at boot time:
sudo systemctl daemon-reload
sudo systemctl start docker
sudo systemctl enable docker
Here's how to install containerd as a binary. This method involves downloading and installing the binary directly without using a package manager (yum, apt). This can help resolve dependency issues or install the latest version in specific environments.
Download the latest version of the binary from the official containerd GitHub release page:
https://github.com/containerd/containerd/releases
For Linux environments, select the containerd-
wget https://github.com/containerd/containerd/releases/download/v1.7.0/containerd-1.7.0-linux-amd64.tar.gz
Extract the downloaded file to the /usr/local directory:
sudo tar Cxzvf /usr/local containerd-1.7.0-linux-amd64.tar.gz
Create a systemd service file to run containerd as a service.
sudo vi /etc/systemd/system/containerd.service
Add the following content:
[Unit]
Description=containerd container runtime
Documentation=https://containerd.io
After=network.target local-fs.target
[Service]
ExecStart=/usr/local/bin/containerd
Restart=always
RestartSec=5
KillMode=process
OOMScoreAdjust=-999
Delegate=yes
LimitNOFILE=1048576
LimitNPROC=infinity
LimitCORE=infinity
TasksMax=infinity
[Install]
WantedBy=multi-user.target
containerd requires a configuration file (/etc/containerd/config.toml).
sudo mkdir -p /etc/containerd
containerd config default | sudo tee /etc/containerd/config.toml
Once the installation is complete, start the containerd service and set it to run automatically at boot time:
sudo systemctl daemon-reload
sudo systemctl start containerd
sudo systemctl enable containerd
Verify that containerd is installed correctly:
ctr version
If you also need Docker Compose, you can directly download and install the binary file:
sudo curl -L "https://github.com/docker/compose/releases/download/v2.20.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
0