|
| 1 | +--- |
| 2 | +title:Docker |
| 3 | +description:Docker is a platform for developing, shipping, and running applications in containers. |
| 4 | +--- |
| 5 | + |
| 6 | +import {File,Folder,Files }from"fumadocs-ui/components/files"; |
| 7 | + |
| 8 | +<divalign="center"> |
| 9 | + <ahref="https://github.com/docker"> |
| 10 | + <img |
| 11 | +alt="Zurg" |
| 12 | +src="/img/docker/docker.png" |
| 13 | +style={{ borderRadius:"10px" }} |
| 14 | + ></img> |
| 15 | + </a> |
| 16 | +</div> |
| 17 | + |
| 18 | +##Overview |
| 19 | + |
| 20 | +Docker is a platform for developing, shipping, and running applications in containers. It allows you to separate you to separate applications from your machine and run them in a container. This is useful for many reasons, such as portability, |
| 21 | +isolation, and resource management. Docker is a very powerful tool and is used in many different applications. |
| 22 | + |
| 23 | +##Prerequisites |
| 24 | + |
| 25 | +##Installation |
| 26 | + |
| 27 | +There are many different ways to install Docker, depending on your operating system. The official Docker documentation has a great guide on how to install Docker on your system. You can find the installation guide[here](https://docs.docker.com/engine/). |
| 28 | + |
| 29 | +What do we recommend? We recommend you to install Docker Engine instead of Docker Desktop (even for WSL2 to prevent any issues). |
| 30 | + |
| 31 | +<Callouttype="info"> |
| 32 | + We will be assuming Linux (Ubuntu) for the rest of the guide. Guide for |
| 33 | + other OSes is not much different. |
| 34 | +</Callout> |
| 35 | + |
| 36 | +###Linux (Ubuntu) |
| 37 | + |
| 38 | +<Callouttype="info"> |
| 39 | + The following commands are for Ubuntu. For other distributions, please refer |
| 40 | + to the official documentation. |
| 41 | +</Callout> |
| 42 | + |
| 43 | +Official[Docker Installation Guide](https://docs.docker.com/engine/install/ubuntu/) will be followed. It is recommended to follow the official guide for the most up-to-date instructions. |
| 44 | + |
| 45 | +<Callouttype="warn"> |
| 46 | + Make sure to follow this[post installation |
| 47 | + step](https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user) |
| 48 | + to manage Docker as a non-root user if following the official guide. |
| 49 | +</Callout> |
| 50 | + |
| 51 | +```bash title="Remove old versions" |
| 52 | +forpkgin docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc;do sudo apt-get remove$pkg;done |
| 53 | +``` |
| 54 | + |
| 55 | +```bash title="Setup Docker's apt repository" |
| 56 | +# Add Docker's official GPG key: |
| 57 | +sudo apt-get update |
| 58 | +sudo apt-get install ca-certificates curl |
| 59 | +sudo install -m 0755 -d /etc/apt/keyrings |
| 60 | +sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc |
| 61 | +sudo chmod a+r /etc/apt/keyrings/docker.asc |
| 62 | + |
| 63 | +# Add the repository to Apt sources: |
| 64 | +echo \ |
| 65 | +"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu\ |
| 66 | +$(. /etc/os-release&&echo"$VERSION_CODENAME") stable"| \ |
| 67 | + sudo tee /etc/apt/sources.list.d/docker.list> /dev/null |
| 68 | +sudo apt-get update |
| 69 | +``` |
| 70 | + |
| 71 | +<Callouttype="info"> |
| 72 | + If you use an Ubuntu derivative distro, such as Linux Mint, you may need to |
| 73 | + use`UBUNTU_CODENAME` instead of`VERSION_CODENAME`. |
| 74 | +</Callout> |
| 75 | + |
| 76 | +```bash title="Install Docker Engine" |
| 77 | +sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin |
| 78 | +``` |
| 79 | + |
| 80 | +```bash title="Post-installation steps for Linux" |
| 81 | +sudo groupadd docker |
| 82 | +sudo usermod -aG docker$USER |
| 83 | +``` |
| 84 | + |
| 85 | +Log out and log back in so that your group membership is re-evaluated. |
| 86 | + |
| 87 | +```bash title="Verify installation" |
| 88 | +docker --version |
| 89 | +docker run hello-world |
| 90 | +``` |