Author Archives: Rolf

Run Pi-hole in a Docker container on a Raspberry Pi

I set up Pi-hole on a Raspberry Pi already a while ago and it is running fine. These are my notes that I took during installation. Unfortunately, the lack some details…

scp docker_run.sh pi@[IP]:docker_run.sh
  • Connect with SSH to the Raspberry Pi
  • run the script
sudo sh docker_run.sh

The script starts well but then encounters an issue after running the container:

Starting up pihole container docker_run.sh: 19: [: healthy: unexpected operator
.docker_run.sh: 19: [: healthy: unexpected operator
.docker_run.sh: 19: [: healthy: unexpected operator
.docker_run.sh: 19: [: healthy: unexpected operator

List all Docker containers

sudo docker container ls

Check the container

sudo docker inspect [Container ID]

Set the password for Pi-hole

Search the log file for the password

sudo docker logs pihole

References

Git: Remove ignored files

You can ignore files in git from being added to the repository by putting a .gitignore file into place. It might however happen that the .gitignore file seems not work. This is the case if you have already included the files in the git repository index.

To resolve the issue, you can perform these commands in your project directory containing the .git folder:

$ git rm -r --cached .
$ git add .
$ git commit -am "Remove ignored files"
  1. First, remove all the files from the git index. Don’t worry, this does not remove the actual local files.
  2. Then add back all files. The .gitignore file controls that git does not add the files to ignore.
  3. Finally, commit the changes.

References

Define the assembly information of an F# .NET Core app

There are several options to define the assembly information of an .NET Core app in F#:

  • .fsproj file
  • Directory.Build.props file
  • When running dotnet build or dotnet publish: -p:Version=a.b.c.d

The information of the .fsproj file seems to have priority over Directory.Build.props file. You can place the Directory.Build.props file in the project folder or the solution folder.

.fsproj file

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>

    <Version>1.0.0.0</Version>
    <FileVersion>1.0.0.0</FileVersion>
    <Product>MyApp</Product>
    <Copyright>Copyright © 2020 by myself</Copyright>
  </PropertyGroup>

  <ItemGroup>
  ...

Directory.Build.props file

<Project>
  <PropertyGroup>
    <Version>1.0.0.0</Version>
    <FileVersion>1.0.0.0</FileVersion>
    <Product>MyApp</Product>
    <Copyright>Copyright © 2020 by myself</Copyright>
  </PropertyGroup>
</Project>

Check the assembly version

The simple way

  • Run: cat MyApp.dll
  • Check the last lines. They contain the assembly information

The convenient way

Install the versioninfo tool and run it on the .dll:

  • dotnet tool install --global dotnet-versioninfo
  • versioninfo MyApp.dll

References