diff --git a/knowledge base/docker.md b/knowledge base/docker.md index fda28ce..b5921ac 100644 --- a/knowledge base/docker.md +++ b/knowledge base/docker.md @@ -208,6 +208,10 @@ docker buildx build … --push \ --cache-from type=registry,ref=012345678901.dkr.ecr.eu-west-2.amazonaws.com/buildkit-test:cache \ --platform 'linux/amd64,linux/arm64,linux/arm/v7' '.' +# Clean up the build cache. +docker buildx prune +docker buildx prune -a + # Remove builders. docker buildx rm 'builder_name' diff --git a/knowledge base/kaniko.md b/knowledge base/kaniko.md index ebb09a3..413d825 100644 --- a/knowledge base/kaniko.md +++ b/knowledge base/kaniko.md @@ -3,6 +3,7 @@ Tool to build container images from a Dockerfile with**out** the need of the Docker engine. 1. [TL;DR](#tldr) +1. [Create local images using local cache](#create-local-images-using-local-cache) 1. [Usage in GitLab pipelines](#usage-in-gitlab-pipelines) 1. [Further readings](#further-readings) 1. [Sources](#sources) @@ -82,7 +83,19 @@ docker run -it --rm -v "$PWD/cache:/cache" 'gcr.io/kaniko-project/warmer' \ Real world use cases
- Create local images using local cache + Test the Dockerfile for an Ansible execution environment the way a GitLab pipeline would need to execute it + +```sh +docker run --rm -ti -v "$PWD:/workspace" 'gcr.io/kaniko-project/executor:debug' /kaniko/executor --no-push +docker run --rm -ti -v "$PWD:/workspace" --entrypoint '' 'gcr.io/kaniko-project/executor:v1.23.2-debug' \ + /kaniko/executor --context '/workspace/someDir' --dockerfile '/workspace/someDir/someDockerfile' --no-push +``` + +
+ + + +## Create local images using local cache Uses images from the local cache.
It does **not** _save_ cache images in the local cache directory since Kaniko is currently **not** able to manage such @@ -100,21 +113,6 @@ docker run --rm -ti -v "$PWD:/workspace" 'gcr.io/kaniko-project/executor:debug' --cache --cache-dir '/workspace/cache' --cache-repo 'oci://cache' ``` - - -
- Test the Dockerfile for an Ansible execution environment the way a GitLab pipeline would need to execute it - -```sh -docker run --rm -ti -v "$PWD:/workspace" 'gcr.io/kaniko-project/executor:debug' /kaniko/executor --no-push -docker run --rm -ti -v "$PWD:/workspace" --entrypoint '' 'gcr.io/kaniko-project/executor:v1.23.2-debug' \ - /kaniko/executor --context '/workspace/someDir' --dockerfile '/workspace/someDir/someDockerfile' --no-push -``` - -
- - - ## Usage in GitLab pipelines ```yaml diff --git a/snippets/docker.sh b/snippets/docker.sh index 5683e67..0fd46d5 100644 --- a/snippets/docker.sh +++ b/snippets/docker.sh @@ -62,7 +62,7 @@ docker buildx build -t 'someTag' '.' docker buildx build '.' -t 'someTag' --platform 'linux/amd64' --progress=plain --no-cache # Remove build cache and leftovers -docker builder prune -a +docker buildx prune docker buildx prune -a # Check logs