0
0
Dockerdevops~10 mins

Installing Docker - Visual Walkthrough

Choose your learning style9 modes available
Process Flow - Installing Docker
Start
Update package info
Install prerequisites
Add Docker repository
Install Docker Engine
Start and enable Docker service
Verify Docker installation
End
This flow shows the step-by-step process to install Docker on a Linux system, from updating packages to verifying the installation.
Execution Sample
Docker
sudo apt update
sudo apt install ca-certificates curl gnupg
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /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" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo systemctl start docker
sudo systemctl enable docker
sudo docker run hello-world
This code installs Docker on Ubuntu, starts the Docker service, enables it on boot, and runs a test container.
Process Table
StepCommandActionResultNotes
1sudo apt updateUpdate package listsPackage info refreshedPrepares system for new installs
2sudo apt install ca-certificates curl gnupgInstall prerequisitesPrerequisites installedNeeded for secure downloads
3sudo mkdir -p /etc/apt/keyringsCreate keyrings directoryDirectory createdStores Docker GPG key
4curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpgDownload and save Docker GPG keyKey saved securelyEnsures package authenticity
5echo "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" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/nullAdd Docker repositoryRepository addedEnables apt to access Docker packages
6sudo apt updateUpdate package lists with Docker repoPackage info refreshed with Docker repoIncludes Docker packages
7sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-pluginInstall Docker Engine and toolsDocker installedCore Docker components ready
8sudo systemctl start dockerStart Docker serviceDocker service runningDocker daemon active
9sudo systemctl enable dockerEnable Docker on bootDocker service enabledStarts automatically on reboot
10sudo docker run hello-worldRun test Docker containerHello from Docker! messageConfirms Docker works
11-EndInstallation completeDocker ready to use
💡 Docker installed, service running, and test container executed successfully
Status Tracker
VariableStartAfter Step 1After Step 6After Step 7After Step 8After Step 10
Package InfoOldUpdatedUpdated with Docker repoSameSameSame
Docker ServiceStoppedStoppedStoppedStoppedRunningRunning
Docker InstallationNot installedNot installedNot installedInstalledInstalledInstalled
Test Container OutputNoneNoneNoneNoneNone"Hello from Docker!"
Key Moments - 3 Insights
Why do we run 'sudo apt update' twice?
The first 'apt update' refreshes package info before installing prerequisites. The second updates package info again after adding Docker's repository to include Docker packages, as shown in execution_table steps 1 and 6.
What does 'sudo systemctl enable docker' do compared to 'start'?
'start' runs Docker immediately (step 8), while 'enable' makes Docker start automatically on system boot (step 9), ensuring Docker runs after reboot.
How do we know Docker installed correctly?
Running 'sudo docker run hello-world' (step 10) outputs a confirmation message 'Hello from Docker!', proving Docker can run containers.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table at step 7. What is installed at this step?
AOnly Docker CLI
BDocker Engine and related tools
CDocker service started
DTest container run
💡 Hint
Check the 'Action' and 'Result' columns at step 7 in execution_table.
At which step does the Docker service start running?
AStep 8
BStep 6
CStep 9
DStep 10
💡 Hint
Look at the 'Docker Service' variable in variable_tracker after each step.
If we skip step 4 (adding Docker GPG key), what will likely happen?
ADocker packages will install without issues
BDocker service will start but not run containers
CPackage authenticity cannot be verified, install may fail
DTest container will run but show warnings
💡 Hint
Step 4 ensures package authenticity; missing it affects package installation security.
Concept Snapshot
Installing Docker on Ubuntu:
1. Update package info (apt update)
2. Install prerequisites (ca-certificates, curl, gnupg)
3. Add Docker GPG key and repo
4. Update package info again
5. Install Docker Engine and tools
6. Start and enable Docker service
7. Run 'hello-world' container to verify
Key: Run 'apt update' after adding repo to get Docker packages.
Full Transcript
To install Docker, first update your system's package list. Then install necessary tools like curl and gnupg to securely download Docker's GPG key. Create a directory to store this key and add Docker's official GPG key to your system. Update your package list again to include Docker's repository. Next, install Docker Engine and related tools. Start the Docker service and enable it to run on boot. Finally, run a test container 'hello-world' to confirm Docker is installed and working correctly.