Docker is an open-source platform that allows developers to automate the deployment and management of applications within lightweight, portable containers. It provides an environment to package software and its dependencies into a standardized unit called a container, which includes everything needed to run the application, such as code, runtime, libraries, and system tools. To install Docker on Ubuntu, you can follow these steps:
- Update the package list to ensure you have the latest package versions:
sudo apt update
- Install the necessary packages to allow apt to use repositories over HTTPS and to support using Docker packages:
sudo apt install apt-transport-https ca-certificates curl software-properties-common
- Add the Docker GPG key to ensure the authenticity of Docker packages:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
- Add the Docker repository to your system's software sources:
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
- Update the package list again to include the Docker packages from the newly added repository:
sudo apt update
- Install Docker by running the following command:
sudo apt install docker-ce docker-ce-cli containerd.io
- Once the installation is complete, Docker should start automatically. You can verify the status of the Docker service by running:
sudo systemctl status docker
If the service is running, you should see output indicating that it is active and running.
-
By default, Docker requires root privileges to run commands. To allow your regular user to use Docker without sudo, you can add your user to the 'docker' group:
sudo usermod -aG docker $USER
Remember to log out and log back in for the group changes to take effect.
Congratulations! You have successfully installed Docker on your Ubuntu system. You can now start using Docker to build, run, and manage containers.