Docker is a platform that allows you to develop, test, and deploy applications as portable containers that can run almost anywhere. Here’s a basic guide to install Docker on Ubuntu:
1. Update your existing list of packages:
\`\`\`bash sudo apt update \`\`\`1. Install a few prerequisite packages which let apt use packages over HTTPS:
\`\`\`bash sudo apt install apt-transport-https ca-certificates curl software-properties-common \`\`\`1. Add the GPG key for the official Docker repository to your system:
\`\`\`bash curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - \`\`\`1. Add the Docker repository to APT sources:
\`\`\`bash sudo add-apt-repository “deb $(lsb\_release -cs) stable“ \`\`\`1. Update the package database with the Docker packages from the newly added repo:
\`\`\`bash sudo apt update \`\`\`1. Make sure you are about to install from the Docker repo instead of the default Ubuntu repo:
\`\`\`bash apt-cache policy docker-ce \`\`\`1. You’ll see output like this, with the Docker repository as the one that will be installed:
\`\`\`bash Installed: (none) Candidate: 5:20.10.6~3-0~ubuntu-focal Version table: 5:20.10.6~3-0~ubuntu-focal 500 500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages \`\`\`1. Finally, install Docker:
\`\`\`bash sudo apt install docker-ce \`\`\`1. Docker should now be installed, the daemon started, and the process enabled to start on boot. Check that it’s running:
\`\`\`bash sudo systemctl status docker \`\`\`After installed Docker, you can use `docker` command to manage your Docker containers, for example:
- `docker pull ubuntu` to pull a ubuntu Docker image.
- `docker run -it ubuntu` to run a Docker container.
- `docker ps` to list Docker containers.
Before proceeding further, please note that you might need to add your user to the `docker` group in order to execute Docker commands without using `sudo` every time:
```
sudo usermod -aG docker ${USER}
```
You may need to log out and log back in for these changes to take affect.
Remember to replace `${USER}` with your username. Now, you should be able to use Docker without requiring sudo.
For more advanced usage, you might want to consult the official Docker documentation or follow a tutorial specific to your use case.