Install Docker on Raspberry Pi


Environment

  • Operating System : Raspbian GNU/Linux 9 (stretch)
  • Model : Raspberry Pi 2 (Model B)

Docker Installation Procedure on Raspberry Pi

The following steps showed the step by step installation guideline.

Raspian Information

  • Check the model of the Raspberry Pi:

    cat /proc/device-tree/model
    

    It confirms that I have a Raspberry Pi 2 (Model B)

    Raspberry Pi 2 Model B Rev 1.1
    
  • Check the Operating System (OS) of the Raspberry Pi:

    cat /etc/os-release
    

    This shows the details information of the OS.

    PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
    NAME="Raspbian GNU/Linux"
    VERSION_ID="9"
    VERSION="9 (stretch)"
    VERSION_CODENAME=stretch
    ID=raspbian
    ID_LIKE=debian
    HOME_URL="http://www.raspbian.org/"
    SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
    BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
    

Install Docker

  • Update and Upgrade Existing Packages:

    sudo apt-get update && sudo apt-get upgrade -y
    
  • Install the Docker client:

    curl -sSL https://get.docker.com | sh
    

    alt docker version

  • Add current user to docker group to user Docker as a non-root user:

    sudo usermod -aG docker ${USER}
    
  • Log out and re login to the system to take effect. Default password of Raspian is: raspberry.

  • Check Docker version:

    docker --version
    Docker version 19.03.12, build 48a6621
    
  • Run the hello-world docker application:

    docker run hello-world
    

    alt docker run hello-world

Reference