Posted by: terrylhowe | November 5, 2025

Docker Clear Cache

I’m always trying to remember how to clear cache with Docker

docker system prune -a

Posted by: terrylhowe | October 11, 2025

Kubernetes Pod Volume from OCI Registry

In order to mount a volume from an OCI registry, you first create your data:

echo "Hello ImageVolume" >artifact.txt

Next build a container image from the data:

cat >Dockerfile <<!
FROM scratch
ADD artifact.txt artifact.txt

!
docker build -t docker.io/terrylhowe/billy:latest .

Next save the image to a directory:

mkdir billy; docker save docker.io/terrylhowe/billy:latest | tar -xC billy

Copy the image to your registry:

oras copy --from-oci-layout ./billy:latest docker.io/terrylhowe/billy

You probably need to set your Kubernetes cluster to enable image volume mount. First make sure you are running a new enough version of Containerd. It should be v2:

k get nodes -o wide

The result from my Kind cluster shows 2.1.3 which works:

NAME                 STATUS   ROLES           AGE   VERSION   INTERNAL-IP   EXTERNAL-IP   OS-IMAGE                         KERNEL-VERSION     CONTAINER-RUNTIME
kind-control-plane   Ready    control-plane   21h   v1.34.0   172.18.0.2    <none>        Debian GNU/Linux 12 (bookworm)   6.10.14-linuxkit   containerd://2.1.3

First, enable image volume for kubelet add to the end of the file:

vi /var/lib/kubelet/config.yaml

Add to the end of the file:

featureGates:
  ImageVolume: true

Make sure the feature gate is enabled:

kubectl -n kube-system describe pod kube-apiserver-kind-control-plane| grep -i imageVolume

Likely it isn’t enabled. If your apiserver is deployed as a static pod like a Kind cluster, you’ll need to docker exec into the container. I installed vim to make it easy with apt-get update and apt-get install vim and then I edited the /etc/kubernetes/manifests/kube-apiserver.yaml and added the command line option:

    - --feature-gates=ImageVolume=true

You will need to wait a bit for the apiserver to restart.

After the apiserver is up, create your pod like:

cat >my-pod.yaml <<!
apiVersion: v1
kind: Pod
metadata:
  name: pod-oci-volume-source
spec:
  containers:
    - name: test
      image: busybox
      command: ["sleep"]
      args: ["infinity"]
      volumeMounts:
        - name: volume
          mountPath: /volume
  volumes:
    - name: volume
      image:
        reference: docker.io/terrylhowe/sammy:latest
        pullPolicy: Always
!

Create the pod:

k create -f my-pod.yaml

Once your pod is up, you can exec into it to see the data:

k exec -it pod-oci-volume-source -- sh

The result:

# cat /volume/artifact.txt 
Hello ImageVolume
Posted by: terrylhowe | September 17, 2025

Helm Push Use –plain-http

I don’t know how many times I get this error:

% helm push mychart2-0.1.0.tgz oci://localhost:15000/helm-charts
Error: failed to perform "Exists" on destination: Head "https://localhost:15000/v2/helm-charts/mychart2/manifests/sha256:2b7ac24bf87c62ed9a1ac6cd39e0c4be73de59fbd39f4d1d6823908201d76b33": http: server gave HTTP response to HTTPS client


I get stuck on the failed to perform "Exists" ignoring the more import reason server gave HTTP response to HTTPS client

The solution is to use the --plain-http option when running Zot or the likely locally.

Posted by: terrylhowe | September 13, 2025

Deleting local and remote git branches

Another thing I always forget, how to delete local and remote branches:

git branch | grep lint | while read branch
do
git branch -D $branch
git push -d origin $branch
done

Posted by: terrylhowe | August 26, 2025

Replace local repository in go.mod

I’m always forgetting the syntax to use a local development copy of a repository in the go.mod file:

replace oras.land/oras-go/v2 => /Users/billy/code/oras-go

Posted by: terrylhowe | February 4, 2023

rm is borked

This is so wrong

% rm -rf out/*
zsh: sure you want to delete all 4 files in /Users/tlhowe/code/oras/out [yn]? y

The solution

setopt localoptions rmstarsilent
Posted by: terrylhowe | February 8, 2021

Raspberry Enable Serial Port uart

Some sensors on the Raspberry work in uart mode over the serial port like the US-100 distance sensor. It isn’t hard to configure this with raspi-config, but I wanted to automate the configuration with Ansible. It tooks me a while, but I finally realized raspi-config is a shell script so I can look at what it is doing.

Looking at raspi-config I can see disabling the console serial capability and enabling serial capabilities on the GPI are not difficult:

---
- name: Disable serial console
  ansible.builtin.replace:
    path: /boot/cmdline.txt
    regexp: 'console=serial0,115200 '
    replace: ''
  become: yes

- name: Enable uart
  ansible.builtin.lineinfile:
    path: /boot/config.txt
    line: 'enable_uart=1'
  become: yes

Posted by: terrylhowe | January 19, 2021

Raspberry Pi Zero and US-100 Distance Sensor

Like most sensors, it takes a while to sort through all the different permutations of the way something can be done to find the way that actually works. The wiring, the software, the configuration all vary from one piece of hardware to the next. With the Pi Zero and the US-100 Y-401 distance sensor in UART mode, you wire the RX to the RX (pin 10/GPIO 15) and the TX to the TX (pin 8/GPIO 14). Use pin 17 for 3v power and pin 20 for ground.

You need to go into the raspi-config and disable the serial console, but keep serial data enabled and then reboot. You also need to enable i2c which can be done in the /boot/config.txt by uncommenting dtparam=i2c_arm=on.

import time
import adafruit_us100
import serial

uart = serial.Serial("/dev/ttyS0", baudrate=9600, timeout=3)
print(uart)
us100 = adafruit_us100.US100(uart)
while True:
    print("-----")
    print("Temperature: ", us100.temperature)
    print("Distance: ", us100.distance)
    time.sleep(0.5)
us-100 wiring

Posted by: terrylhowe | February 19, 2018

Ansible Dump Variables

I’m often looking for the way to dump the variables available to ansible and I used to have a role just to do that, but sometimes a role is more than you need.  Sometimes just dumping them will do:

---
- hosts: localhost
  tasks:
      - debug:
          msg: "{{ vars | to_nice_json }}"

 

Posted by: terrylhowe | February 19, 2018

Permanently Remove Siri etc from Dock

Every time I reboot, siri, maps, etc reappear on the dock and I have to remove them again.  Very annoying to have apps that I am not using keep showing up on the dock.  To permanently remove them from the dock, disable and enable system integrity protection:

sudo /usr/libexec/PlistBuddy -c "delete:add-app" \
 /System/Library/CoreServices/Dock.app/Contents/Resources/com.apple.dockfixup.plist
sudo /usr/libexec/PlistBuddy -c "delete:add-doc" \
 /System/Library/CoreServices/Dock.app/Contents/Resources/com.apple.dockfixup.plist

Older Posts »

Categories

Design a site like this with WordPress.com
Get started