What is Docker?
Docker is a tool designed to make it easier to create, deploy, and run applications by using containers. Containers allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and deploy it as one package. By doing so, thanks to the container, the developer can rest assured that the application will run on any other Linux machine regardless of any customized settings that machine might have that could differ from the machine used for writing and testing the code.
Prior to installing Docker
Be sure to run
sudo apt-get update and
sudo apt-get upgrade.
Run the following command:
curl -sSL https://get.docker.com | sh
You are going to want to add the proper permissions to your primary user account to easily run docker commands. To do that, run the following command:
sudo usermod -aG docker YOURUSER
YOURUSER with the name of the user you are logged in as.
Reboot your machine by running:
To keep everything running smoothly, you’ll want to run the following commands to install the following dependencies:
sudo apt-get install libffi-dev libssl-dev
sudo apt-get install -y python python-pip
sudo apt-get remove python-configparser
Docker should be running by this point. Running the following command should pull an image from the Docker Hub and display hello-world on your screen. 1
docker run hello-world
Install Docker Compose
For more advanced scenarios, you can install Docker Compose to allow you multiple containers that are dependent on each other with a single command: 1
sudo pip install docker-compose
Now that Docker is running you can explore the Docker Hub to find various containers to run.