Skip to content

Instantly share code, notes, and snippets.

@madsonic
Last active April 17, 2020 04:52
Show Gist options
  • Save madsonic/5fa062425de67a5946926e770b86698d to your computer and use it in GitHub Desktop.
Save madsonic/5fa062425de67a5946926e770b86698d to your computer and use it in GitHub Desktop.
Cheat sheet related to k8/docker/helm and other related technologies
# long
docker run --rm -ti \
--publish <container port>:<exposed port> \
--env <env>=<val> \
--volume <local path>:<mounted path> \
<repo>/<image>:<tag>
# short
docker run --rm -ti \
-p <container port>:<exposed port> \
[-e <env>=<val> | --env-file <list of files>] \
-v <local path>:<mounted path> \
<repo>/<image>:<tag>
# existing container
docker exec -ti container_name sh
# Runs a one time container in your kubernetes cluster
# long form
kubectl run --tty --stdin --rm --restart Never --namespace <namespace> --image=<your-image> sh
# short form
kubectl run -ti --rm --restart Never -n <namespace> --image=<your-image> sh
# existing container, works like a ssh
kubectl exec -n <namespace> -ti -c <container> <pod> -- /bin/bash
# set current context to use given namespace
# instead of doing kubectl -n namespace all the time
kubectl config set-context --current --namespace="yournamespace"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment