curl -sSL https://get.docker.com/ | sh
To break this down:
curl -sSL https://get.docker.com/
- Use curl to download the Docker installation script from the official Docker website silently (-s) and following redirects (-L)| sh
- Pipe the output of the curl command to the sh shell to execute the installation script
So by piping the Docker installation script directly to sh in one line, this command downloads and executes the script to install Docker without any user interaction needed.
A couple notes on this approach:
- It requires curl to be installed already
- It runs the installation script as root, so it will have full access to set up Docker
- It installs the latest version of Docker CE headlessly
You can then verify Docker is installed and running by checking the output of:
docker version
So in just a single line, we can go from no Docker to having docker installed and ready to use on Ubuntu!