Docker is a popular containerization platform that allows you to build, deploy, and run applications in containers. Here are the steps to install and set up Docker on Ubuntu:
1. Update the package index and install the necessary packages:
```sudo apt update
sudo apt install apt-transport-https ca-certificates curl gnupg lsb-release
```
2. Add the Docker GPG key:
```curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
```
3. Add the Docker repository to your system:
```echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
```
4. Update the package index again and install Docker:
```sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io
```
5. Verify that Docker is installed and running:
```sudo systemctl status docker
```
You should see output indicating that Docker is active and running.
6. Add your user to the Docker group:
```sudo usermod -aG docker your-user
```
Replace "your-user" with your username. This allows you to run Docker commands without using "sudo".
7. Test Docker by running the "hello-world" container:
```docker run hello-world
```
Docker will download the "hello-world" container image and run it. You should see output indicating that Docker is working correctly.
That's it! You have successfully installed and set up Docker on Ubuntu.