Docker Raspberry Pi Gpio
Learn how to install Portainer to your Raspberry Pi. Portainer is a Docker management tool that makes managing your containers a breeze. Creating and maintaining your Docker containers becomes a simple task when using this web interface.
Earlier this week I set up .NET Core and Docker on a Raspberry Pi and found that I could run my podcast website quite easily on a Pi. Check that post out as there's a lot going on. I can test within a Linux Container and output the test results to the host and then open them in VS. I also explored a reasonably complex Dockerfile that is both multiarch and multistage. I can reliably build and test my website either inside a container or on the bare metal of Windows or Linux. Very fun.
- The database that is being used in the docker-compose file on the site isn’t compatible with ARM processors, so we’ll need to change that in a bit. But first, we need to get logged in to our Raspberry Pi’s Portainer. This tutorial assumes that you already have Docker and Portainer installed, most likely via OpenMediaVault.
- Raspberry Pi 3B+ The Raspberry Pi 3B+ supports USB mass storage boot out of the box. Raspberry Pi 2B v1.2, 3A+, 3B, Compute Module 3, 3+ On the Raspberry Pi 2B v1.2, 3A+, 3B, and Compute Module 3, 3+ you must first enable USB host boot mode. This is to allow USB mass storage boot, and network boot. Note that network boot is not supported on the.
- The Pi Hole project already has a nice Docker project utilizing compose. The Pi Hole Docker install is well documented and quite nicely done. After installing Docker on the Raspberry Pi it was an easy git clone, a couple of modifications to select my timezone and preferred DNS servers ( CloudFlare 1.1.1.1 ), then docker-compose up, and we were.
As primarily a Windows developer I have lots of batch/cmd files like 'test.bat' or 'dockerbuild.bat.' They start as little throwaway bits of automation but as the project grows inevitably more complex.
I'm not interested in 'selling' anyone PowerShell. If you like bash, use bash, it's lovely, as are shell scripts. PowerShell is object-oriented in its pipeline, moving lists of real objects as standard output. They are different and most importantly, they can live together. Just like you might call Python scripts from bash, you can call PowerShell scripts from bash, or vice versa. Another tool in our toolkits.
Bash and shell scripts are SUPER powerful. It's a whole world. But it is text based (or json for some newer things) so you're often thinking about text more.
You can take it as far as you like. For some it's intuitive power, for others, it's baroque.
Point is, there's choice. Here's a nice article about PowerShell from the perspective of a Linux user. Can I install PowerShell on my Raspberry Pi (or any Linux machine) and use the same scripts in both places? YES.
For many years PowerShell was a Windows-only thing that was part of the closed Windows ecosystem. In fact, here's video of me nearly 12 years ago (I was working in banking) talking to Jeffrey Snover about PowerShell. Today, PowerShell is open source up at https://github.com/PowerShell with lots of docs and scripts, also open source. PowerShell is supported on Windows, Mac, and a half-dozen Linuxes. Sound familiar? That's because it's powered (ahem) by open source cross platform .NET Core. You can get PowerShell Core 6.0 here on any platform.
Don't want to install it? Start it up in Docker in seconds with
Sweet. How about Raspbian on my ARMv7 based Raspberry Pi? I was running Raspbian Jessie and PowerShell is supported on Raspbian Stretch (newer) so I upgraded from Jesse to Stretch (and tidied up and did the firmware while I'm at it) with:
Cool. Now I'm on Raspbian Stretch on my Raspberry Pi 3. Let's install PowerShell! These are just the most basic Getting Started instructions. Check out GitHub for advanced and detailed info if you have issues with prerequisites or paths.
NOTE: Here I'm getting PowerShell Core 6.0.2. Be sure to check the releases page for newer releases if you're reading this in the future. I've also used 6.1.0 (in preview) with success. The next 6.1 preview will upgrade to .NET Core 2.1. If you're just evaluating, get the latest preview as it'll have the most recent bug fixes.
Lovely.
GOTCHA: Because I upgraded from Jessie to Stretch, I ran into a bug where libssl1.0.0 is getting loaded over libssl1.0.2. This is a complex native issue with interaction between PowerShell and .NET Core 2.0 that's being fixed. Only upgraded machines like mind will it it, but it's easily fixed with sudo apt-get remove libssl1.0.0
Now this means my PowerShell build scripts can work on both Windows and Linux. This is a deeply trivial example (just one line) but note the 'shebang' at the top that lets Linux know what a *.ps1 file is for. That means I can keep using bash/zsh/fish on Raspbian, but still 'build.ps1' or 'test.ps1' on any platform.
Here's a few totally random but lovely PowerShell examples:
Installing Docker In Raspberry Pi
You can take PowerShell objects to and from Objects, Hashtables, JSON, etc.
Here's a nice one from MCPMag:
Or a one-liner if you want to be obnoxious.
Example: This won't work on Linux as it's using Windows specific AIPs, but if you've got PowerShell on your Windows machine, try out this one-liner for a cool demo:
iex (New-Object Net.WebClient).DownloadString('http://bit.ly/e0Mw9w')
Thoughts?
Sponsor: Check out JetBrains Rider: a cross-platform .NET IDE. Edit, refactor, test and debug ASP.NET, .NET Framework, .NET Core, Xamarin or Unity applications. Learn more and download a 30-day trial!
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.