What is Docker?
Docker is a popular containerization platform that allows you to run applications in their own isolated environments. Containerization is often seen as the next evolution of virtualization technology and is often run within virtual machine environments for extra security.
Ubuntu is one of the more popular Linux distributions due to user familiarity and stability.
Today we’re going to install docker on Ubuntu 19 “Disco Dingo” as well as show you how you can access a list of Docker Commands.
The “Easy” Way
There is a script which drastically shortens the amount of time and commands needed to install docker. Here’s the script:
Step 1: type:
curl -fsSL https://get.docker.com -o get-docker.sh
Step 2: type
sudo sh get-docker.sh
And that’s really it. Those 2 commands should get docker installed on your system.
The “Traditional” Way
Before actually installing Docker on Ubuntu we are going to have to prepare some things like downloading repos and making sure docker is being downloaded from the proper source to take advantage of the latest release.
- If you are using Ubuntu GUI, you will need to locate and open the terminal application. Sometimes this is hidden. If you can’t see it listed in the application drawer on the dock, just search for ‘terminal’ and it will show up.
sudo apt update in the terminal. What this does it is update internet repositories which is essential for finding and downloading the latest version of Docker.
sudo apt install apt-transport-https ca-certificates curl software-properties-common
4. The curl command is going to let us turn our terminal into the medium that downloads the docker resource files rather than our web browser. This is both convenient for GUI users and allows you to download docker with or without a GUI.
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –
5. You’ll need to pay attention to this part. When we download our repository to install docker its going to want to attach to the version of Ubuntu we are running. Depending on the version of Ubuntu you are running the command you are going to type will be different. You will also need to know the name of your Ubuntu installation. For example, Ubuntu 19 is “Disco Dingo” and will be abbreviated in the terminal as “Disco”
sudo add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu disco stable”
Now that we’ve prepared the proper repositories and are prepared to download Docker from the internet using our terminal, its time to actually install docker.
6. With all our repositories updated and downloaded we’re all set to go, lets just do a quick sudo apt update
7. Its important to make sure you set your policy to download from Docker and not any other Ubuntu repositories for this reason we are going to set our policy to download from docker specifically.
Apt-cache policy docker-ce
from here, you will see 3 things:
- Is Docker installed? (it will say none)
- Candidate: this is the version of Ubuntu that docker has targeted for the installation (should say your Ubuntu version) If any resources were not installed properly earlier this section will say none
- Version table: a list of docker versions for this particular version of Ubuntu
sudo apt install docker-ce
Once that final step has been completed you should have Docker installed. A good way to find out if Docker is properly installed is to use the same apt-cache policy docker-ce command to see if this time there is a version of Docker installed.
As you can see, after typing apt-cache policy docker-ce our version of Ubuntu is listed next to installed
Another good way to see if Docker is installed is to bring up a list of commands that you can use to control and configure Docker. If Docker is properly installed, the terminal will start to accept Docker commands.
To get a list of commands:
Now that docker is installed, Ubuntu will recognize Docker commands in the control panel allowing you to implement containerization and begin developing with Docker on your system.