Docker Install Ubuntu Script

Docker Installation Ubuntu Shell Script

To automatically install Docker on Ubuntu run:

wget -O - https://raw.githubusercontent.com/proars/Docker-Install-Ubuntu-Script/main/docker_install.sh | bash

Or create a new file setup.sh with below given code and run it:

#!/bin/bash
sudo apt-get -y remove docker docker-engine docker.io containerd runc
sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg lsb-release curl
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 $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo chmod a+r /etc/apt/keyrings/docker.gpg
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin

Verify Your Docker Installation

To confirm that your Docker installation is successful, run the hello-world image by executing the following command:

sudo service docker start
sudo docker run hello-world

This command pulls a test image and runs it within a container. Once the container executes, it displays a confirmation message and then terminates.

Congratulations! You have successfully installed and launched the Docker Engine.

GitHub

   

If you like what you are reading, please:

Buy me a coffeeBuy me a coffee

arstech

Start the discussion at forum.arstech.net