Skip to content

Instantly share code, notes, and snippets.

View dmcgowan's full-sized avatar

Derek McGowan dmcgowan

View GitHub Profile
@dmcgowan
dmcgowan / main.go
Created April 16, 2023 07:48
Proxy differ using containerd default applier
/*
Copyright The containerd Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@dmcgowan
dmcgowan / overlay_test.sh
Created April 27, 2018 21:30
Test overlay multiple depths
#!/bin/sh
set -x
tempdir=$(mktemp -d)
oldpwd=$(pwd)
function cleanup() {
cd $oldpwd
umount -fR $tempdir
@dmcgowan
dmcgowan / containerd.service
Last active October 25, 2017 00:39
Containerd stress run script
[Unit]
Description=containerd container runtime
Documentation=https://containerd.io
After=network.target
[Service]
ExecStartPre=/sbin/modprobe overlay
ExecStart=/usr/local/bin/containerd
Delegate=yes
KillMode=process
@dmcgowan
dmcgowan / image_backend.go
Created May 5, 2017 23:26
Notes about requirements of Daemon for image management backend
package daemon
import (
"io"
"github.com/docker/distribution/reference"
"github.com/docker/docker/image"
"github.com/docker/docker/layer"
digest "github.com/opencontainers/go-digest"
)
@dmcgowan
dmcgowan / fetch.sh
Last active January 24, 2017 21:36
Script to fetch image configurations from hub
#!/bin/sh
if [ "$#" -ne 2 ]; then
echo "Wrong arguments, expect: <name> <tag>"
fi
IMAGE=$1
TAG=$2
TOKEN=$(curl -s "https://auth.docker.io/token?scope=repository:$IMAGE:pull&service=registry.docker.io" | jq -r .token)
CONFIG_DIGEST=$(curl -s -H"Accept: application/vnd.docker.distribution.manifest.v2+json" -H"Authorization: Bearer $TOKEN" "https://registry-1.docker.io/v2/$IMAGE/manifests/$TAG" | jq -r .config.digest)
#!/bin/sh
set -e
tmpdir=$(mktemp -d)
volume=$1
shift
if [ ! -f $volume ]; then
@dmcgowan
dmcgowan / overlay_test.sh
Created July 29, 2016 21:12
Demonstrate overlay bug with opaque directories using multiple lowers
#!/bin/sh
set -e
root=$(mktemp -d)
echo "--- Running in $root"
cd $root
mkdir -p lower1/lib
@dmcgowan
dmcgowan / update.diff
Last active July 8, 2016 17:00
Use `--` to specify variadic positional arguments
diff --git a/api/client/service/update.go b/api/client/service/update.go
index dc6e34c..f35bc17 100644
--- a/api/client/service/update.go
+++ b/api/client/service/update.go
@@ -2,6 +2,7 @@ package service
import (
"fmt"
+ "strings"
"time"
@dmcgowan
dmcgowan / testrun.sh
Created June 30, 2016 22:28
Test docker run on fresh device
#!/bin/env sh
# testrun.sh runs a docker container on a fresh device
# to test for errors mounting and running a container.
#
# Usage:
# sh testrun.sh <device> <storage driver> <image> [<run arg>, ...]
#
# How to use:
# $ fallocate -l 2GB testvolume
@dmcgowan
dmcgowan / imagesize.sh
Last active May 17, 2016 22:05
Docker image disk usage tool
#!/bin/env sh
# imagesize.sh calculates the on disk size of images by pulling
# and comparing inode and block usage. Requires using a fresh
# device to accurately measure the difference caused by each
# image. This is intended to measure the on disk size caused
# by pulling an image with docker rather than the sum of all
# the file usage just inside the docker graph driver directory.
#
# Usage: