1. Home
  2. Linux
  3. Install docker images on linux

How to install Docker Images on Linux

A Docker Image is a self-contained micro-operating system that comes with specialized software. The software in these images usually amounts to complex web applications, runtimes, etc.

The most popular tool for running pre-built images (also known to some as containers) on Linux is a tool known as Docker. It’s a robust piece of software, and it runs on nearly every Linux distribution. With it, users can quickly and easily download thousands of pre-configured images ranging from the Nginx web server to a simple Plex Media server.

Get Docker for Linux

Docker is one of the best tools that Linux has to offer. However, it’s not a piece of software that comes with Linux distributions out of the box, preconfigured. The fact that Docker doesn’t come pre-installed is understandable, as it’s a sophisticated tool, and it’s probably a good idea that users know how to set it up and maintain it before using it in a production setting.

The primary way of using Docker on Linux is through officially downloadable packages and software repositories. As of now, you can easily download and install Docker on most mainstream Linux distributions, including Ubuntu, Debian, and Fedora. Learn more about how to set it up here.

Don’t run a Linux distribution that has first-class support for Docker? You’re in luck! In recent years, Docker has made it’s way to the Snap store as a Snap package. Better yet, since it’s a Snap, users from Arch Linux to even Gentoo can get it working right away.

Docker via Snap

In our tutorial about setting up Docker on Linux, we neglected to talk about the Snap version. We didn’t cover it because the Snap wasn’t available at that time. So, we’ll briefly go over how you can get the Snap version of Docker.

Note: before you try to install the Snap version of Docker on your Linux server or Desktop, you must be running Snapd. Unsure about how to set up Snapd? Check out this post!

Once you’ve got Snapd running on your server or desktop, use the following command to install Docker via Snap.

sudo snap install docker --edge

With Docker working via Snap, finish up the setup process with these commands.

Note: be sure to change “username” in the third command with the username you plan to use Docker with on Linux.

sudo snap connect docker:home
sudo groupadd --system docker
sudo usermod -a -G docker username
newgrp docker
sudo snap disable docker
sudo snap enable docker

Docker image from Docker Hub

Docker images are hosted on the website Docker Hub. Anyone can upload an image, set up with whatever they’d like. Best of all, images don’t cost money! They’re free for everyone to use forever!

Getting a Docker image on a Linux system via Docker Hub is done through the “pull” command. If you’re new to Docker and need to install an image, follow the step-by-step instructions below.

Step 1: Head on over to the Docker Hub website. Once you’re on the site, find the “Register” button and click it to sign up for an account.

Step 2: Sign into your new Docker Hub account by clicking on the “Sign In” button at the top of the page.

Step 3: Now that you’re signed in, you’re ready to start downloading Docker images. Locate the search box and type out the type of image you’d like. Alternatively, if you don’t know where to start, check out some of the official ones they have here.

Step 4: After deciding on a Docker image you’d like to grab, click on it in the search results. This will take you to the dedicated page of the image.

Step 5: Find the “Copy and paste to pull this image” section of the page. Directly underneath that text, you’ll see the official command to download that particular image. It should look something like the example below.

docker pull image-name

Step 6: Copy the command from the page and return to your terminal. Then, press Ctrl + Shift + V to paste the command into the terminal.

Step 7: Let the pull command run and download the image. Once the image is done, refer to the page of the image you just installed. It’ll have instructions that outline how to use it.

Uninstall a Docker image

Getting rid of an installed Docker image on Linux is done with the rmi command. To delete and erase an existing image, you’ll first need to run the images command. Using images will allow you to see the name of the images on your system.

docker images

Look through the list and copy the name of the image you’d like to remove. Then, write docker rmi along with the name of the image.

docker rmi image-name