diff --git a/docs/developers/local-setup.md b/docs/developers/local-setup.md index 17a94e5278c..7d822664ec4 100644 --- a/docs/developers/local-setup.md +++ b/docs/developers/local-setup.md @@ -12,7 +12,7 @@ This section provides guidelines for running Tekton on your local workstation vi Complete these prerequisites to run Tekton locally using Docker Desktop: - Install the [required tools](https://github.com/tektoncd/pipeline/blob/main/DEVELOPMENT.md#requirements). -- Install [Docker Desktop](https://www.docker.com/products/docker-desktop) +- Install [Docker Desktop](https://www.docker.com/products/docker-desktop) - Configure Docker Desktop ([Mac](https://docs.docker.com/docker-for-mac/#resources), [Windows](https://docs.docker.com/docker-for-windows/#resources))to use six CPUs, 10 GB of RAM and 2GB of swap space. - Set `host.docker.internal:5000` as an insecure registry with Docker for Desktop. See the [Docker insecure registry documentation](https://docs.docker.com/registry/insecure/). for details. @@ -82,3 +82,129 @@ If you wish to use a different image URL, you can add the appropriate line to mi ### Reconfigure logging See the information in the "Docker for Desktop" section + +## Using kind and local docker registry + +### Prerequisites + +Complete these prerequisites to run Tekton locally using Kind: + +- Install the [required tools](https://github.com/tektoncd/pipeline/blob/main/DEVELOPMENT.md#requirements). +- Install [Docker](https://www.docker.com/get-started). +- Install [kind](https://kind.sigs.k8s.io/). + +### Use local registry without authentication + +See [Using KinD](https://github.com/tektoncd/pipeline/blob/main/DEVELOPMENT.md#using-kind). + +### Use local private registry + +1. Create password file with basic auth. + +```bash +export TEST_USER=testuser +export TEST_PASS=testpassword +if [ ! -f auth ]; then + mkdir auth +fi +docker run \ + --entrypoint htpasswd \ + httpd:2 -Bbn $TEST_USER $TEST_PASS > auth/htpasswd +``` + +2. Start kind cluster and local private registry + + +Execute the script. + +```shell +#!/bin/sh +set -o errexit + +# create registry container unless it already exists +reg_name='kind-registry' +reg_port='5000' +running="$(docker inspect -f '{{.State.Running}}' "${reg_name}" 2>/dev/null || true)" +if [ "${running}" != 'true' ]; then + docker run \ + -d --restart=always -p "127.0.0.1:${reg_port}:5000" --name "${reg_name}" \ + -v "$(pwd)"/auth:/auth \ + -e "REGISTRY_AUTH=htpasswd" \ + -e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" \ + -e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd \ + registry:2 +fi + +# create a cluster with the local registry enabled in containerd +cat <