Docker
Docker is a platform used for developing, shipping, and running applications in containers. Installing it can sometimes involve several steps, and if you’re setting up multiple machines or doing it frequently, remembering the exact process can be tedious.
This note serves as a quick reference for installing Docker using the convenience script provided by the Docker team.
Download the script:
curl -fsSL https://get.docker.com -o install-docker.shThis command downloads the installation script from get.docker.com and saves it as
install-docker.sh.Run the script:
sudo sh install-docker.shThis executes the downloaded script with superuser privileges to perform the installation.
Add your user to the
dockergroup:sudo usermod -aG docker (username)Replace
(username)with your actual username. This command adds your current user to thedockergroup. Membership in this group allows you to run Docker commands without needingsudo. While convenient, understand that members of thedockergroup have permissions equivalent to the root user regarding Docker, so exercise caution.Reboot your system:
sudo rebootA reboot is usually required for the group changes made in the previous step to take effect.
Verify the installation: After your system has restarted and you’ve logged back in, you can verify that Docker is installed and you can run commands without
sudoby running thehello-worldcontainer:docker run hello-worldThis command downloads a test image and runs it in a container. If everything is set up correctly, you should see a message confirming that your Docker installation is working.