To install Docker on a DigitalOcean droplet, you can follow these steps:
- Log in to your droplet via SSH.
- Update the package index and install some prerequisite packages:
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
- Add Docker’s GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- Add the Docker repository to your system’s software sources:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
- Update the package index again:
sudo apt-get update
- Install Docker:
sudo apt-get install docker-ce docker-ce-cli containerd.io
- Verify that Docker is installed correctly by running the following command:
sudo docker run hello-world
This should output a message indicating that Docker is working correctly.
That’s it! You have now installed Docker on your DigitalOcean droplet.