Technology Encyclopedia Home >How to install and use Docker on Raspbian?

How to install and use Docker on Raspbian?

To install Docker on Raspbian, you can follow these steps:

Step 1: Update Your System

First, ensure your Raspbian system is up to date:

sudo apt-get update
sudo apt-get upgrade -y

Step 2: Install Docker

Add the Docker repository and install Docker:

curl -sSL https://get.docker.com | sh
sudo usermod -aG docker pi

After running these commands, log out and log back in for the changes to take effect.

Step 3: Verify Installation

Check if Docker is installed correctly by running:

docker --version

You should see the Docker version printed.

Step 4: Run a Test Container

To ensure everything is working, run a simple Docker container:

docker run hello-world

This command downloads and runs the hello-world Docker image, which verifies that your installation is successful.

Example Usage

Here’s how you might run a more practical container, like a web server:

docker run -d -p 8080:80 nginx

This command runs an Nginx web server in a Docker container and maps port 8080 on your Raspberry Pi to port 80 in the container.

Recommended Cloud Service

For managing Docker containers in a more scalable and efficient manner, consider using Tencent Cloud's TKE (Tencent Kubernetes Engine). TKE allows you to deploy, manage, and scale containerized applications easily. It integrates well with Docker and provides a robust platform for container orchestration.

By following these steps, you can effectively install and use Docker on your Raspberry Pi running Raspbian.