copatcher
Introduction
copatcher is a container patcher written in Go.
Prerequisites
Install
# container-diff
curl -LO https://storage.googleapis.com/container-diff/latest/container-diff-linux-amd64
chmod +x container-diff-linux-amd64
sudo install container-diff-linux-amd64 /usr/local/bin/container-diff
# buildkit
docker pull moby/buildkit:latest
Update
# Install packages
docker run -it --rm --name ubuntu-22.04-container ubuntu:22.04 /bin/bash
$ apt update && \
apt install tmux && \
apt install python3-pip && \
apt install nodejs && \
apt install npm && \
npm install -g eslint && \
pip install flake8
# Run Commit
docker commit -m "Create new image from container's changes" \
ubuntu-22.04-container ubuntu:22.04-updated
Run
# Run container-diff
container-diff diff --type=apt --type=node --type=pip --json \
daemon://ubuntu:22.04 daemon://ubuntu:22.04-updated > report.json
# Run buildkit
docker run --detach --rm --privileged --name buildkitd \
--entrypoint buildkitd moby/buildkit:latest
# OR
docker run --detach --rm --privileged -p 127.0.0.1:8888:8888/tcp --name buildkitd \
--entrypoint buildkitd moby/buildkit:latest --address tcp://0.0.0.0:8888
# Run copatcher
version=latest make build
./bin/copatcher --image ubuntu:22.04 --report report.json --tag 22.04-patched --timeout "5m" \
--address "docker-container://buildkitd" --ignore-errors
# OR
./bin/copatcher --image ubuntu:22.04 --report report.json --tag 22.04-patched --timeout "5m" \
--address "tcp://0.0.0.0:8888" --ignore-errors
Docker
version=latest make docker
docker run ghcr.io/craftslab/copatcher:latest [options]
Usage
usage: copatcher --image=IMAGE --report=REPORT --tag=TAG [<flags>]
Container patcher
Flags:
--[no-]help Show context-sensitive help (also try --help-long and --help-man).
--[no-]version Show application version.
--address="unix:///run/buildkit/buildkitd.sock"
Address of buildkitd service
--[no-]ignore-errors Ignore errors and continue patching
--image=IMAGE Application image name and tag to patch
--report=REPORT Report file generated by container-diff
--tag=TAG Tag for the patched image
--timeout="5m" Timeout for the operation
Design
License
Project License can be found here.
Reference