Cloud Native 6 min read

Step-by-Step Guide to Installing Docker on CentOS, Ubuntu, and Windows

This comprehensive tutorial walks you through uninstalling old Docker versions, setting up repositories, installing Docker Engine, and verifying the installation on CentOS, Ubuntu 14.04/16.04, and Windows (including Docker Toolbox for Win7/8 and Docker Desktop for Win10), with all necessary commands and screenshots.

Open Source Linux
Open Source Linux
Open Source Linux
Step-by-Step Guide to Installing Docker on CentOS, Ubuntu, and Windows

CentOS Docker Installation

1. Uninstall old versions (if any)

yum remove docker docker-common docker-selinux docker-engine

2. Install required packages

yum install -y yum-utils device-mapper-persistent-data lvm2

// yum-utils provides yum-config-manager // device mapper storage driver needs device-mapper-persistent-data and lvm2 3. Add Docker yum repository

yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

4. List available Docker versions yum list docker-ce --showduplicates | sort -r 5. Install Docker

yum -y install docker-ce   # installs the latest stable version
yum -y install docker-ce-17.03.1.ce   # install a specific version

6. Start Docker and enable on boot

systemctl start docker
systemctl enable docker

7. Verify installation

docker version

Ubuntu 14.04 / 16.04 Docker Installation

# Step 1: Remove old versions
apt-get remove docker docker-engine docker.io containerd runc

# Step 2: Update package index
apt-get update

# Step 3: Install prerequisite packages
apt-get -y install apt-transport-https ca-certificates curl software-properties-common

# Step 4: Add Docker’s official GPG key
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -

# Step 5: Set up the stable repository
add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"

# Step 6: Install Docker CE
apt-get -y install docker-ce

# (Optional) Install a specific version
apt-get -y install docker-ce=[VERSION]

Windows Docker Installation

Win7 / Win8 – Docker Toolbox

Download Docker Toolbox from http://mirrors.aliyun.com/docker-toolbox/windows/docker-toolbox/ and run the installer, selecting the required components.

After installation three icons appear; launch the Docker QuickStart Terminal.

If a User Account Control prompt appears, click Yes to allow VirtualBox to make changes.

Win10 – Docker Desktop

Docker Desktop for Windows 10 requires Hyper‑V to be enabled.

Enable Hyper‑V via Programs and Features → Turn Windows features on or off → Hyper‑V .

Download Docker Desktop from https://www.docker.com/get-docker , run the installer, and follow the prompts (Next → Finish).

After installation Docker starts automatically; a whale icon appears in the system tray.

Verify the installation with:

docker version
docker run hello-world

If Docker does not start automatically, launch it from the Start menu or by searching “Docker”.

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.

DockercontainerizationWindowsInstallationCentOSUbuntu
Open Source Linux
Written by

Open Source Linux

Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.

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.