Skip to content

Instantly share code, notes, and snippets.

@ragul28
ragul28 / Docker-Cleanup.md
Created January 11, 2020 09:01
Docker Cleanup commands

Docker Cleanup Commands

  • images cleanup
docker rmi $(docker images --filter "dangling=true" -q --no-trunc)
  • image cleanup based on name
docker rmi $(docker images | grep "asia.gcr.io" | awk '{print $3}')
@ragul28
ragul28 / Docker-Export.md
Created January 11, 2020 09:02
Docker Container & image export/import

Export running or paused Container:

  • Export
docker export <dockernameortag> | gzip > mycontainer.tgz
  • Load
gunzip -c mycontainer.tgz | docker load
@ragul28
ragul28 / Kube-Ingress-Cert.md
Created January 11, 2020 09:09
K8S nginx ingress & cert-manager installation

Kube Ingress with Cert-Manager

  • install helm2
kubectl create clusterrolebinding cluster-admin-binding \
  --clusterrole cluster-admin \
  --user $(gcloud config get-value account)
kubectl create serviceaccount --namespace kube-system tiller
@ragul28
ragul28 / daemonset-scaledown.md
Created January 11, 2020 09:20
k8s Trick to Scale down daemonset to zero
  • Scaling k8s daemonset down to zero
kubectl -n kube-system patch daemonset myDaemonset -p '{"spec": {"template": {"spec": {"nodeSelector": {"non-existing": "true"}}}}}'
  • Scaling up k8s daemonset
kubectl -n kube-system patch daemonset myDaemonset --type json -p='[{"op": "remove", "path": "/spec/template/spec/nodeSelector/non-existing"}]'
@ragul28
ragul28 / k8s-debug.md
Created January 11, 2020 09:25
Useful kubectl commands for debug
  • kube current cluster info
kubectl config current-context
kubectl cluster-info
kubectl get events
  • kube top
kubectl top pod --all-namespaces
@ragul28
ragul28 / k8s-debug.md
Created January 11, 2020 09:25
Useful kubectl commands for debug
  • kube current cluster info
kubectl config current-context
kubectl cluster-info
kubectl get events
  • kube top
kubectl top pod --all-namespaces
@ragul28
ragul28 / docker-install.md
Created January 11, 2020 10:01
Install docker in Debian/Ubuntu with auto completion

Easy Installation docker

  • Init installtion & add user to docker group (not recommanded for prod usage)
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker $USER
  • Sanity check
@ragul28
ragul28 / docker-compose-elasticsearch.yml
Created January 11, 2020 10:13
Docker Elasticsearch with single-node - for dev
version: '3'
services:
elasticsearch:
#image: elasticsearch:5-alpine
image: elasticsearch:latest
environment:
- discovery.type=single-node
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms256m -Xmx256m"
ulimits:
@ragul28
ragul28 / docker-compose-vault.yml
Created January 11, 2020 10:17
Docker HC Vault in dev mode
version: '3'
services:
vault:
image: vault:latest
container_name: vault-dev
ports:
- "8200:8200"
restart: always
environment:
VAULT_ADDR: http://127.0.0.1:8200
@ragul28
ragul28 / docker-compose-rabbitmq.yml
Created January 11, 2020 10:23
Rabbitmq - Docker
version: '3'
services:
rabbitmq:
image: rabbitmq:3-management
container_name: rabbitmq
hostname: rabbitmq
restart: always
ports:
- "15672:15672"
- "5672:5672"