Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install Docker for raspberry pie

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how to install Docker in raspberry pie". It is easy to understand and well organized. I hope it can help you solve your doubts. Let me lead you to study and learn this article "how to install Docker in raspberry pie".

Raspberry pie is based on the ARM architecture, unlike PC. So even if you can do some docker images on the raspberry pie, you can't run it on other PC. Conversely, docker images on other PC cannot run on raspberry pie.

If you need to find a special image for raspberry pie, search Dockerhub for ARM or Rpi.

There is a warehouse called Hypriot that makes a lot of docker for raspberry pie.

Raspberry pie to install Docker, the most difficult is to correctly select the source and add GPG-key, in order to find the right version of docker and download. This process is very tedious and difficult to have a unified plan.

One-click installation script for the official version

Note: the official one-click installation script is no longer supported by many people. However, the current position can actually be supported.

Reference: The easy way to set up Docker on a Raspberry Pi

Before I start the implementation, let's make it clear: I haven't been successful many times before, and I haven't found a lot of related solutions. Until.

Not until I sudo apt-get update first and the most important thing is sudo apt-get upgrade.

In fact, you can see in upgrade that a lot of system dependency packages have been updated, which solves all the problems with the unsuccessful installation of docker before.

After the upgrade is complete, the official installation begins:

You need to use a shell script, get.docker.com, the only script for the whole site. Download and execute:

$curl-fsSL get.docker.com-o get-docker.sh & & sh get-docker.sh

When you are finished, it displays:

Then run hello world to try:

$sudo docker run hello-world

Then display:

Manual installation

Preparatory work:

# related to installing SSL Let apt download via HTTPS: sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common# add docker's GPG keycurl-fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add-# check whether the key matches (9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBFCD88) sudo apt-key fingerprint 0EBFCD88# add docker apt download source sudo echo "\ ndeb-src [arch=amd64] https://download.docker.com/linux/debian wheezy stable \ n "> > / etc/apt/sources.list# update source sudo apt-get update

Install docker:

$sudo apt-get install docker-ce

No need for sudo to execute docker

In order not to always enter sudo for each execution of docker, we need to create a user group for docker and grant permissions:

# create a docker user group sudo groupadd docker# to add the current user to the docker user group sudo gpasswd-a $USER docker# update the current user group change (no need to log out and log in again) newgrp docker

Install docker-compose

You can download and run docker compose as a container for docker:

Docker run\-v / var/run/docker.sock:/var/run/docker.sock\-v "$PWD:/rootfs/$PWD"\-w = "/ rootfs/$PWD"\ docker/compose:1.13.0 up# set the alias shortcut key (`~ / .zshrc` or` ~ / .bash_ profile`) alias docker-compose= "''docker run\-v / var/run/docker.sock:/var/run/docker.sock\-v" $PWD:/rootfs / $PWD "\-w =" / rootfs/$PWD "\ docker/compose:1.13.0'"'"

Common error problems

Python: No module name lsb_release

First check to see if lsb_release is installed on this machine, or reinstall it:

$sudo apt-get install lsb-release

If this is the same problem, check the Python version. If it is python3, it is likely that the version is not enough, because lsb_release requires a minimum of python3.5.

To solve this problem, just set the default python back to python2. It's just a ln that sets up shortcuts:

# backup (the specific location of python is determined according to your own situation) $sudo mv / usr/bin/python / usr/bin/python_bak# replace $sudo ln-s / usr/bin/python2.7 / usr/bin/python

Then try $lsb_release-cs again to see if jessie is displayed.

Unable to add source add-apt-repository error could not find related source

The above is all the contents of the article "how to install Docker for raspberry pie". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report