| by Arround The Web | No comments

2 Easy Methods to Install Docker on Raspberry Pi

Docker is an open-source platform to create, edit, and run applications in the container. The container is a lightweight, loosely created environment where you have the freedom to package and run an application. You can run multiple containers at a single host without worrying about utilizing the system resources and it contains everything you need to run an application on the system.

Thus, you can speed up the development process through docker since it reduces the time for writing and running code in production.

In this article, you will learn how to install docker on your Raspberry Pi system through different methods.

2 Easy Methods to Install Docker on Raspberry Pi

There are two simplest methods to install docker on Raspberry Pi:

  • Install Docker on Raspberry Pi Through Script
  • Install Docker on Raspberry Pi Through Snap

Method 1: Install Docker on Raspberry Pi Through Script

The docker’s developers created a script to easily download and install it on any Linux system and to download and install the docker through the script, follow the below-mentioned steps:

Step 1: Download Docker Script on Raspberry Pi

You must download the script needed for installing the docker on your Raspberry Pi system and you can do it from the following command:

$ curl -fsSL https://get.docker.com -o get-docker.sh

Step 2: Execute the Script

You must execute the script on your Raspberry Pi system from the following command to install docker on Raspberry Pi successfully.

$ sudo sh get-docker.sh

The above script will successfully install the docker on your Raspberry Pi system.

Step 3: Confirms the Docker Version on Raspberry Pi

To confirm the docker version installed on your Raspberry Pi system through the script, you can apply the following command:

$ docker version

The above output confirms that installation of the latest docker version on your Raspberry Pi system.

Step 4: Add a Non-Root User to Group

You can add a non-root user to your docker group so they can execute docker commands on Raspberry Pi system. I am adding the default “pi” user to the group so that I can execute the commands later.

$ sudo usermod -aG docker <username>

Step 5: Run Docker Container on Raspberry Pi

To ensure docker is running on your Raspberry Pi system, you can execute the following command for running the container Hello World on Raspberry Pi.

$ sudo docker run hello-world

The output ensures that docker runs on your Raspberry Pi system.

Remove Docker from Raspberry Pi

You can run the following command to successfully remove docker with the required plugins from the Raspberry Pi system.

$ sudo apt-get purge docker-ce docker-ce-cli docker-compose-plugin -y

The above command will remove the docker with required plugins from the Raspberry Pi system.

Method 2: Install Docker on Raspberry Pi Through Snap Store

You can also install docker on your Raspberry Pi system through snap using the following steps:

Step 1: Install Snap Daemon on Raspberry Pi

First, you must install snap daemon on your Raspberry Pi system from the following command:

$ sudo apt install snapd -y

Step 2: Install Docker from Snap

Next, you can install docker from the snap store using the following command:

$ sudo snap install docker

Remove Docker from Snap Store

You can remove docker installed from this method using the following command:

$ sudo snap remove docker

That’s all from this guide.

Conclusion

Docker is a platform that allows Raspberry Pi users to create, edit and run the application in containers without burdening the host operating systems. You can install docker on the Raspberry Pi system by running the script downloaded from the official website or using the snap service.

Share Button

Source: linuxhint.com

Leave a Reply