# How to install Docker on Ubuntu

Docker lets you run applications in containers. Fast, portable, and efficient.

***

### Requirements

* Linux [VPS](https://ititanhosting.com/vps)/[Dedicated Server](https://ititanhosting.com/dedicated)
* SSH + sudo

***

### Step 1: Remove old versions

```bash
sudo apt remove docker docker.io containerd runc -y
```

***

### Step 2: Install dependencies

```bash
sudo apt update
sudo apt install ca-certificates curl gnupg -y
```

***

### Step 3: Add Docker repo

```bash
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker.gpg
```

***

### Step 4: Install Docker

```bash
sudo apt install docker-ce docker-ce-cli containerd.io -y
```

***

### Step 5: Start Docker

```bash
sudo systemctl start docker
sudo systemctl enable docker
```

***

### Step 6: Test

```bash
docker run hello-world
```

***

### Step 7: Run without sudo

```bash
sudo usermod -aG docker $USER
newgrp docker
```

***

### Basic commands

Run container:

```bash
docker run -d -p 8080:80 nginx
```

List:

```bash
docker ps
```

***

### Done 🐳

Docker is ready!


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ititanhosting.ro/docs/english/vps/linux/how-to-install-docker-on-ubuntu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
