Installing Docker

Docker provides the software so that you can run containers. A container is an executable that contains everything you need to run the software it contains. For example, if I have a Linux system configured to run Hadoop, Hive, and Ambari, and I create a container from it, I can give you the container, and when you run it, it will contain everything you need for that system to work, no matter the configuration or software installed on your computer. The same applies if I give that container image to any other person. It will always run the same. A container is not a virtual machine. A virtual machine is an abstraction at the hardware level and a container is an abstraction at the application layer. A container has everything you need to run a piece of software. For this chapter, that is all you need to know.

Now that you have Linux installed and have an understanding of what Docker is, you can install a copy of Docker. Using your terminal, enter the following command:

curl -fsSL https://get.docker.com/ | sh

The preceding command uses the curl application to download and install the latest version of Docker. The parameters tell curl to, in order, fail silently on server errors, do not show progress, report any errors, and redirect if the server says the location has changed. The output of the curl command is piped - | - to the sh (Bash shell) to execute.

When Docker has installed, you can run it by executing the following command:

sudo systemctl start docker

The previous command uses sudo to run the command as an administrator (root). Think of this as right-clicking in Windows and selecting the Run as administrator option. The next command is systemctl. This is how you start services in Linux. Lastly, start docker does exactly that, it starts docker. If you receive an error when executing the earlier mentioned command that mentions sudoers, your user may not have permission to run applications as the root. You will need to log in as the root (or use the su command) and edit the text file at /etc/sudoers. Add the following line:

your username  ALL=(ALL) ALL

The previous line will give you permission to use sudo. Your /etc/sudoers file should look like the following screenshot:

Now that you have docker running, you can download the image we will load which contains the Hadoop framework.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset