In the previous two recipes, we went through the different steps required to install Docker on Ubuntu and CentOS. Those steps are fine when you are only installing it on a host or two, but what if you need to install it on a hundred? In that case, you would want something a little more automated to speed up the process. This recipe shows you how to install Docker on different Linux flavors using an install script that is provided by Docker.
Installing Docker on Linux with an automated script
Getting ready
Like all scripts that you download off the internet, the first thing you should do is examine the script and make sure you know what it is doing before you use it. To do this, go through the following steps:
- Visit https://get.docker.com in your favorite web browser to review the script, and make sure you are comfortable with what it is doing. If in doubt, don't use it.
- The script needs to be run as root or with sudo privileges.
- If Docker has already been installed on the host, it needs to be removed before running the script.
The script currently works with the following flavors of Linux: CentOS, Fedora, Debian, Ubuntu, and Raspbian.
How to do it
To use the script, go through the following steps:
- Download the script to the host system:
$ curl -fsSL get.docker.com -o get-docker.sh
- Run the script:
$ sudo sh get-docker.sh
How it works...
The preceding recipe used an automated script to install Docker on Linux.
There's more...
In order to upgrade Docker, you will need to use the package manager on your host. Rerunning the script can cause issues if it attempts to re-add repositories that were already added. See the previous recipes to learn how to upgrade Docker on CentOS and Ubuntu using their respective package managers.