Installing Docker on Your Dedicated Server
Docker allows you to run applications in isolated containers, making deployment consistent and repeatable across environments.
Install Docker on Ubuntu/Debian
apt update
apt install ca-certificates curl gnupg -y
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
apt update
apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
Verify Installation
docker --version
docker run hello-world
Run Docker Without sudo
usermod -aG docker $USER
newgrp docker
Enable Docker at Boot
systemctl enable docker
systemctl start docker
Basic Docker Commands
docker ps # List running containers
docker ps -a # List all containers
docker images # List downloaded images
docker pull nginx # Download an image
docker stop <id> # Stop a container
docker rm <id> # Remove a container
docker rmi <image> # Remove an image