List of optional addons for kubernetes running in Docker Desktop
Helm (optional)
Install Helm package manager for Kubernetes. unlike Rancher-Desktop, Docker-Desktop doesnot include Helm by default.
brewinstallhelm
Traefik (optional)
Follow this setup GUIDE to add Traefik Proxy with Docker Compose or local Kubernetes running in Docker-Desktop
DevOps tools
Install optional DevOps tools for SREs
brewinstallkubectx# to switch kube context, namespace quickly. https://github.com/ahmetb/kubectxbrewinstallkubens# to switch kube quicklybrewinstallkubernetes-helm# package manager for Kubernetesbrewinstallkustomize# Kubernetes native configuration managementbrewinstallstefanprodan/tap/kustomizer# package manager for distributing Kubernetes configuration as OCI artifactsbrewinstallderailed/k9s/k9s# Manage Your k8s In Style!brewinstallistioctl# Istio configuration command line utilitybrew install dive # A tool for exploring a docker image, layer contents, and discovering ways to shrink the size of your Docker/OCI image
brewinstallcrane# A tool for interacting with remote images and registries.brewtapanchore/syft&&brewinstallsyft# SBOM toolbrewinstallcosign# Container Signing, Verification and Storage in an OCI registry.brewinstallskaffold# build and deploy docker imagesgoinstallsigs.k8s.io/bom/cmd/bom@latest# Create SPDX-compliant Bill of Materials
Usage
dockerinfodockerversiondockerstatsdockercontextlist# to use tools like dive, you may need to switch context to docker-desktopdockercontextusedocker-desktopdockertopCONTAINERdockervolumelsdockernetworkls
# List builder instancesdockerbuildxls# inspect current builder instancedockerbuildxinspectdockerbuildximagetoolsinspect<MULTI_PLATFORM_IMAGE>dockerbuildximagetoolsinspect--rawnginx:alpine|jq
Images
dockerbuild.dockertagdockertagSOURCE_IMAGE[:TAG]TARGET_IMAGE[:TAG]dockerimagesdockerlogin-uaaaa-pbbb# Log in to your repository, I am using GitHub container registryexport GITHUB_PACKAGES_TOKEN=ghp_YOUR_TOKENdockerlogin-u{github_username}-p{[token](https://github.com/settings/tokens)}ghcr.io# inspect imagedockerinspectredislabs/redismod:edgedockerinspect--format"{{.Architecture}}"redislabs/redismod:edge# Remove one or more imagesdockerrmidocker.vectorized.io/vectorized/redpanda:v21.11.2# default from docker.iodockerpulljwsy/jade-shooter:v1.1dockerimages|grepjwsydockerrun-d-p8080:80jwsy/jade-shooter:v1.1dockerrun-d-p80:80--name=nginx--restart=alwaysnginx# `e2a5` is output from above commanddockerexec-ite2a5shdockerimages# save loaddockersave-olocal_jwsy_jade-shooter_v1.2.tardockerload-ilocal_jwsy_jade-shooter_v1.2.tar
# Generate a key-pair: cosign.key and cosign.pubcosigngenerate-key-pair# Export your COSIGN_PASSWORD to prevent CLI promptingexport COSIGN_PASSWORD=$COSIGN_PASSWORD
Sign the container image while pushing:
# Sign the image with Keyless modedockerpush--sign=cosigndevopps/hello-world# Sign the image and store the signature in the registrydockerpush--sign=cosign--cosign-keycosign.keydevopps/hello-world
Verify the container image while pulling:
# Verify the image with Keyless modedockerpull--verify=cosigndevopps/hello-world
# push firstdockerpush-ghcr.io/xmlking/grpc-starter-kit/base:v0.2.0# then sigh and verifyCOSIGN_EXPERIMENTAL=1cosignsignghcr.io/xmlking/grpc-starter-kit/base:v0.2.0COSIGN_EXPERIMENTAL=1cosignverifyghcr.io/xmlking/grpc-starter-kit/base:v0.2.0
Generate and upload the SBOM
We will use the syft to generate the SBOM and once its generated we will attach to image using cosign
# Let’s first generate the SBOMsyftpackagesghcr.io/junaid18183/sampleapp:0.0.1-ospdx>latest.spdxcosignattachsbom--sbomlatest.spdxghcr.io/xmlking/sampleapp:0.0.1
Dive
To explore docker image layers:
divespring-service:1.6.5-SNAPSHOT
Compose
dockercompose-finfra/redis.ymlupredisdockercompose-finfra/redpanda.ymlupredpandadockercompose-finfra/redpanda.ymllogsdockercompose-finfra/redis.ymldowndockercompose-finfra/redpanda.ymldown# this will stop redpanda and remove all volumesdockercompose-finfra/redpanda.ymldown-vdockercompose-finfra/redpanda.ymlps# name of the container can be found from output of above commanddockerexec-itinfra_redpanda_1/bin/bashdockerexec-itinfra_redpanda_1rpkversiondockerexec-itinfra_redpanda_1rpktopiclistdockerexec-itinfra_redpanda_1rpkclusterinfo# verify if docker `compose` getting correctly resolved application config from .envdockercomposeconfig# implicitly set `env-file` to `.env`dockercompose--env-file.env--env-file.secretsconfig# explicitly set `env-file` to `.env` and `.secrets`# ssh to container (if needed to debug)dockercomposeexec-itredpanda \rpk topicconsumetwitch_chat--brokers=localhost:9092# Ordockerexec-itredpanda-1 \rpk topicproducetwitch_chat--brokers=localhost:9092dockerexec-itredpanda-1 \rpk topicconsumetwitch_chat--brokers=localhost:9092