2026年10月19日月曜日

docker 25 から 29 にアップグレードする方法

docker 25 から 29 にアップグレードする方法

概要

ついに 25 が EOL になったのでアップグレード

環境

  • Ubuntu 22.04

更新先のバージョンの確認

  • apt -y update
  • apt-cache policy docker-ce docker-ce-cli
  • apt list --all-versions docker-ce | head -n 10

更新可能な最新バージョンをメモ

ピン留めの修正

  • cp docker.pref docker.pref.back
  • vim docker.pref
Explanation: Pin added by DevOps with GitLab
Package: docker-ce*
Pin: version 5:29.9.1-1~ubuntu.22.04~jammy
Pin-Priority: 600

更新

  • apt install --dry-run docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
  • apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
root@ubuntu:/etc/apt/preferences.d# apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
docker-buildx-plugin is already the newest version (0.38.0-1~ubuntu.22.04~jammy).
docker-buildx-plugin set to manually installed.
docker-compose-plugin is already the newest version (5.6.0-1~ubuntu.22.04~jammy).
docker-compose-plugin set to manually installed.
The following packages were automatically installed and are no longer required:
  libfwupd2 libfwupdplugin5 libgcab-1.0-0 libgusb2 libltdl7 libmbim-glib4 libmbim-proxy libmm-glib0 libqmi-glib5 libqmi-proxy libsmbios-c2 libtcl8.6 modemmanager
  tcl tcl8.6 usb-modeswitch usb-modeswitch-data
Use 'apt autoremove' to remove them.
Suggested packages:
  cgroupfs-mount | cgroup-lite docker-model-plugin
The following packages will be upgraded:
  containerd.io docker-ce docker-ce-cli
3 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
Need to get 65.4 MB of archives.
After this operation, 22.6 MB of additional disk space will be used.
N: Ignoring file 'docker.pref.back' in directory '/etc/apt/preferences.d/' as it has an invalid filename extension
Do you want to continue? [Y/n] Y
Get:1 https://download.docker.com/linux/ubuntu jammy/stable amd64 docker-ce-cli amd64 5:29.9.1-1~ubuntu.22.04~jammy [17.6 MB]
Get:2 https://download.docker.com/linux/ubuntu jammy/stable amd64 containerd.io amd64 2.4.2-2~ubuntu.22.04~jammy [23.3 MB]
Get:3 https://download.docker.com/linux/ubuntu jammy/stable amd64 docker-ce amd64 5:29.9.1-1~ubuntu.22.04~jammy [24.6 MB]
Fetched 65.4 MB in 1s (48.8 MB/s)
(Reading database ... 109872 files and directories currently installed.)
Preparing to unpack .../docker-ce-cli_5%3a29.9.1-1~ubuntu.22.04~jammy_amd64.deb ...
Unpacking docker-ce-cli (5:29.9.1-1~ubuntu.22.04~jammy) over (5:25.0.5-1~ubuntu.22.04~jammy) ...
Preparing to unpack .../containerd.io_2.4.2-2~ubuntu.22.04~jammy_amd64.deb ...
Unpacking containerd.io (2.4.2-2~ubuntu.22.04~jammy) over (2.4.1-2~ubuntu.22.04~jammy) ...
Preparing to unpack .../docker-ce_5%3a29.9.1-1~ubuntu.22.04~jammy_amd64.deb ...
Unpacking docker-ce (5:29.9.1-1~ubuntu.22.04~jammy) over (5:25.0.5-1~ubuntu.22.04~jammy) ...
Setting up containerd.io (2.4.2-2~ubuntu.22.04~jammy) ...
/usr/sbin/policy-rc.d returned 101, not running 'restart containerd.service'
Setting up docker-ce-cli (5:29.9.1-1~ubuntu.22.04~jammy) ...
Setting up docker-ce (5:29.9.1-1~ubuntu.22.04~jammy) ...
invoke-rc.d: policy-rc.d denied execution of restart.
/usr/sbin/policy-rc.d returned 101, not running 'restart docker.service docker.socket'
Processing triggers for man-db (2.10.2-1) ...
Scanning processes...
Scanning candidates...
Scanning linux images...

Running kernel seems to be up-to-date.

Restarting services...
 systemctl restart fwupd.service irqbalance.service multipathd.service open-vm-tools.service packagekit.service polkit.service rsyslog.service ssh.service systemd-timesyncd.service systemd-udevd.service udisks2.service unbound.service upower.service
Service restarts being deferred:
 systemctl restart ModemManager.service
 systemctl restart containerd.service
 /etc/needrestart/restart.d/dbus.service
 systemctl restart docker.service
 systemctl restart networkd-dispatcher.service
 systemctl restart systemd-logind.service
 systemctl restart unattended-upgrades.service

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.

docker 再起動

  • systemctl restart containerd.service
  • systemctl restart docker.service

確認

  • docker version
Client: Docker Engine - Community
 Version:           29.9.1
 API version:       1.56
 Go version:        go1.26.9
 Git commit:        dfc520d
 Built:             Wed Oct 14 18:32:26 2026
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          29.9.1
  API version:      1.56 (minimum version 1.40)
  Go version:       go1.26.9
  Git commit:       b26fb77
  Built:            Wed Oct 14 18:32:26 2026
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v2.4.2
  GitCommit:        b7a25261e029d68978bbf290df0a62fc819b3c51
 runc:
  Version:          1.5.2
  GitCommit:        v1.5.2-0-g29dd3dc2
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

最後に

今回は Docker CE のバージョンを APT preferences で指定しています。次回以降に更新する場合は、リポジトリの更新候補を確認し、必要に応じてピン留め設定を変更します。

Docker 公式リポジトリは unattended-upgrades の対象にしていないため、自動更新は行われません。

2026年10月6日火曜日

strix 超入門

strix 超入門

概要

https://github.com/usestrix/strix

環境

  • Ubuntu 24.04
  • strix 1.17.0
  • litellm

litellm

インストール

  • curl -sSL https://strix.ai/install | bash

起動

  • export STRIX_LLM="gemini-3.5-flash"
  • export LLM_API_BASE="http://localhost:4000/"
  • export LLM_API_KEY="dummy"

実行

  • strix --target ./api
  • strix --target http://localhost:8080

最後に

  • 普通に攻撃になるのでご注意を
  • トークンはかなり使います
  • コード解析の場合自動で脆弱になりそうな箇所を診断し攻撃してくれます
    • 各種インジェクション
    • 例えば jinja2 テンプレートを使う箇所があれば自動でテンプレートインジェクションできるかチェックしてくれます

最後に

AI x ハックは強すぎる気がします

2026年9月11日金曜日

コミットの author と committer をすべて指定したユーザで書き換える方法

コミットの author と committer をすべて指定したユーザで書き換える方法

概要

.git/config などを設定して無くグローバルの user,email を使ってしまっていた場合に全件 author と committer を書き換えたい場合があるかなと思います
その方法を紹介します

環境

  • macOS 26.6.2
  • git 2.55.0

書き換え

NEW_NAME="your_user_name"
NEW_EMAIL="your_user_email@local"

git stash push -u -m 'temp-before-identity-rewrite' && \
FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch --force --env-filter "
GIT_AUTHOR_NAME=\"$NEW_NAME\"
GIT_AUTHOR_EMAIL=\"$NEW_EMAIL\"
GIT_COMMITTER_NAME=\"$NEW_NAME\"
GIT_COMMITTER_EMAIL=\"$NEW_EMAIL\"
export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL
" master && \
git stash pop

確認

0 になれば OK です

git log master --format='%an%x09%ae%x09%cn%x09%ce' |
awk -F '\t' -v new_name="$NEW_NAME" -v new_email="$NEW_EMAIL" \
  '$1 != new_name || $2 != new_email || $3 != new_name || $4 != new_email { count++ }
   END { print count+0 }'

強制上書き

git push -f origin master

後処理

git update-ref -d refs/original/refs/heads/master

最後に

ちゃんと最初に .git/config は書いておきましょう

2026年9月5日土曜日

docker compose で起動したコンテナがどの作業ディレクトリで動いているか確認する方法

docker compose で起動したコンテナがどの作業ディレクトリで動いているか確認する方法

概要

docker compose でいろいろなパスで docker compose up -d していると忘れるので一覧で表示する方法を紹介します

コマンド

docker ps -q | xargs -I {} docker inspect -f '{{ index .Config.Labels "com.docker.compose.project.working_dir" }}' {}

2026年9月4日金曜日

GCP の ArtifactRegistry にある latest タグ以外のイメージを一括で削除する方法

GCP の ArtifactRegistry にある latest タグ以外のイメージを一括で削除する方法

概要

CLI を使いましょう

環境

  • macOS 26.6.2
  • gcloud cli 545.0.0

タグの一覧を表示

gcloud artifacts docker images list \
  asia-northeast1-docker.pkg.dev/product-123456/gae-standard/app/default \
  --include-tags --format='get(version,tags)'

対象のタグに絞り込む

gcloud artifacts docker images list \
  asia-northeast1-docker.pkg.dev/product-123456/gae-standard/app/default \
  --include-tags \
  --format='get(version,tags)' |
while read -r version tags; do
  if [[ "$tags" != *latest* ]]; then
    echo ${tags}
    echo ${version}
  fi
done

絞り込んだイメージを削除

gcloud artifacts docker images list \
  asia-northeast1-docker.pkg.dev/product-123456/gae-standard/app/default \
  --include-tags \
  --format='get(version,tags)' |
while read -r version tags; do
  if [[ "$tags" != *latest* ]]; then
    echo ${tags}
    echo ${version}

    gcloud artifacts docker images delete \
      "asia-northeast1-docker.pkg.dev/product-123456/gae-standard/app/default@$version" \
      --delete-tags \
      --quiet
  fi
done

最後に

プロジェクトのIDやリポジトリ名やパッケージ名は適宜変更してください

2026年9月3日木曜日

Xcode26 で ipa ファイルを作成する方法

Xcode26 で ipa ファイルを作成する方法

概要

なぜか xcode からだとエンロール関係でエラーになるので CLI を使いましょう

環境

  • macOS 26.6.2
  • Xcode 26.6 (17F113)
  • iPhone 15

事前準備

  • Xcode に無料の Developer Account でログイン
  • Xcode で開発用の証明書作成
  • iPhone 実機の接続

ビルド: app フォルダの作成

xcodebuild -workspace ios-moributa.xcworkspace \
           -scheme ios-moributa \
           -sdk iphoneos \
           -configuration Release \
           -archivePath ./build/ios-moributa.xcarchive \
           archive

アーカイブ: ipa ファイルの作成

xcodebuild -workspace ios-moributa.xcworkspace \
           -scheme ios-moributa \
           -sdk iphoneos \
           -configuration Release \
           -archivePath ./build/ios-moributa.xcarchive \
           archive

配布設定ファイルの作成

  • vim ExportOptions.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://apple.com">
<plist version="1.0">
<dict>
    <key>method</key>
    <string>development</string> <!-- 開発用証明書(iOS Development)で書き出す -->
    <key>signingStyle</key>
    <string>automatic</string>
</dict>
</plist>

最後に

ワークスペース名やスキーマ名は適宜変更してください

2026年9月2日水曜日

AltStore で the data couldn’t be read because it isn’t in the correct format

AltStore で the data couldn’t be read because it isn’t in the correct format

概要

対応策を紹介します

環境

  • macOS 26.6.2
  • AltServer 1.7.2
  • AltStore 2.2.1

対応策

  • iPhone の wifi をオフにする
  • Mac と有線接続する
  • AltServer 起動
  • AltStore 起動
  • アプリの更新

最後に

macOS をアップデートすると出る気がしなくもないです