Setup Docker on Raspberry Pi
You can Setup and work with Docker on Raspberry Pi. Let see how you can setup your Raspberry Pi and run your first container on it.
First You need a Raspberry Pi with Raspbian OS. If Your is not ready, You canDownload Raspbian from Raspberrypi.org ‘s download section: https://www.raspberrypi.org/downloads/raspbian/. You need to flash this downloaded image to the micro SD card. Assuming your laptop has a SD card slot, you need a flashing software like etcher. Go ahead and download from: https://etcher.io/
Recommended: How To Use Raspberry pi in a truely headless mode
Setup Docker on Raspberry Pi
Now Your Pi Ready, Open terminal and follow given below Steps.
1. Update Packages:
Update Raspberry Pi packages using the following command –
sudo apt-get update && sudo apt-get upgrade
2. Install Docker:
Install Docker using following command –
curl -sSL https://get.docker.com | sh
3. Add permission to User to run Docker Commands:
Add “pi” user to “docker” group using the following command –
sudo usermod -aG docker pi
You must Log off from Raspberry Pi and Login again, for this to take effect.
4. Verify Installation:
Check Docker installation using the “docker –version” command. If you see the correct version, you are good to go.
[email protected]:~ $ docker --version Docker version 17.05.0-ce, build 89658be [email protected]:~ $
5. Run Hello-World Program:
Run the ARM-based “hello-word” Docker container using “docker run armhf/hello-world” command. All the Docker Images under the namespace armhf are created by Docker team.
You can NOT run the default “hello-world” container (using “docker run hello-world” command) on Raspberry Pi as it is created for X86 Architecture and won’t work on ARM architecture based Raspberry Pi.
On successful execution, you should see following output on your Raspberry Pi –
[email protected]:~ $ docker run armhf/hello-world Unable to find image 'armhf/hello-world:latest' locally latest: Pulling from armhf/hello-world a0691bf12e4e: Pull complete Digest: sha256:9701edc932223a66e49dd6c894a11db8c2cf4eccd1414f1ec105a623bf Status: Downloaded newer image for armhf/hello-world:latest Hello from Docker on armhf! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker Hub account: https://hub.docker.com For more examples and ideas, visit: https://docs.docker.com/engine/userguide/ [email protected]:~ $
- If you see the following error, reboot your Raspberry Pi and try again –
docker: Error response from daemon: failed to create endpoint compassionate_joliot on network bridge: failed to add the host (veth0685c4b) <=> sandbox (vethccfe136) pair interfaces: operation not supported. ERRO error getting events from daemon: net/http: request canceled
- If you see the following error, it means you are trying to run an X86 container on ARM machine i.e. Raspberry Pi. This is because the binary format used by ARM is not compatible with x86.
standard_init_linux.go:178: exec user process caused "exec format error"
I hope you like this post”Setup Docker on Raspberry Pi”. Do you have any questions? Leave a comment down below! Thanks for reading. If you like this post probably you might like my next ones, so please support me by subscribing my blog.
Explore Some more Raspberry Pi Tutorials :
- Raspberry Pi – Introduction | Overview | Setup and Management | Tutorials
- How to Install Mosquitto Broker on Raspberry Pi
- Setting up SPI on Raspberry Pi
- Getting Started with The Sense HAT – Raspberry Pi
- Raspberry Pi GPIO Basics
- Controlling LED with Raspberry Pi PART-2
- How To Setup Static IP Address on Raspberry Pi
- Controlling LED with Raspberry Pi
- Interfacing a light Sensor (LDR) with Raspberry Pi
- Remote control your Raspberry Pi from your PC with VNC!
- How To Use Raspberry pi in a truely headless mode
- ROCK Pi 4 : Overview | Installation
- Best OS for Raspberry Pi
- How to setup Bluetooth on a Raspberry Pi 3
- Simple Raspberry Pi Home Security System
- Raspbian – OS For Raspberry Pi
- Setting up a Raspberry Pi headless
4 thoughts on “Setup Docker on Raspberry Pi”
Pingback: Setup Docker on Raspberry Pi — IoTbyHVM – Bits & Bytes of IoT – hashstacks
Pingback: How to Boot Up Raspberry Pi 3 from External Hard Disk
Pingback: RedConnect - Flow Based Programming - IoTbyHVM - Bits & Bytes of IoT
Pingback: Docker Hub – The world’s leading container content library and ecosystem - CoolDigiBytes