Docker and Kubernetes CLI Reference
Search Docker, Compose and kubectl commands in plain words, such as follow logs, shell into a container or roll back a deployment, with the right flags and safety notes.
S'executa al teu navegador. Els fitxers mai no surten del dispositiu. Mira com comprovar-ho
…
Com es fa
- 1Search
Type the task in plain words.
- 2Filter
Pick a section, or show only careful commands.
- 3Read the notes
Check what each flag does.
- 4Copy
Replace names and placeholders.
- 5Run
Use the command in your terminal.
- 6Save
Download the CSV for your runbook.
Sobre aquesta eina
Containers bring two command-line tools most developers half-remember: docker for images and containers on one machine, and kubectl for clusters. When something breaks at 2 a.m., you need the exact command quickly: how to follow a pod's logs from the crashed container, how to open a shell inside a running container, how to roll back a deployment, how to free disk space without deleting volumes you still need. This reference groups the commands by task: images, containers, Compose, volumes and networks, clean-up, kubectl basics, applying manifests, deployments, debugging and configuration. Each entry explains what the command and its flags do, and commands that delete data are flagged. Search in plain words, filter by section, or show only the commands that need care, and download the list as CSV.
Debugging a failing pod
1. kubectl get pods to see the status (CrashLoopBackOff, ImagePullBackOff, Pending). 2. kubectl describe pod for events: image pull errors, failed probes, scheduling problems. 3. kubectl logs --previous for the output of the container that crashed. 4. kubectl get events --sort-by=.lastTimestamp for the bigger picture. 5. kubectl debug to attach a container with tools when the image has none.
Freeing disk space safely
docker system df shows what uses space. docker system prune removes stopped containers, unused networks and dangling images but keeps volumes. Adding -a and --volumes removes everything unused including volumes, which deletes data, so it is flagged.
Compose versus docker run
Compose files describe a whole application and are easier to keep in Git than long docker run commands. Our Dockerfile and Compose generator converts docker run commands into compose.yaml.
Rollouts
kubectl rollout status waits for a deployment, rollout undo returns to the previous version and rollout restart replaces all pods, which is useful after changing a ConfigMap.
Building and publishing images
Tag images with a version or commit hash rather than latest, so deployments are reproducible and rollbacks pick the right image. docker buildx build --platform builds for both Intel and ARM servers in one step, and docker image history shows which layer makes an image large.
Compose day to day
docker compose up -d --build rebuilds and restarts only what changed, docker compose logs -f follows one service and docker compose config prints the final merged file, which is the quickest way to spot an indentation mistake or an unexpanded variable.
Secrets
Kubernetes Secrets are only base64-encoded unless the cluster encrypts them at rest; treat access to them carefully.
Limits
The list covers everyday commands. Cluster administration, Helm, service meshes and cloud-provider CLIs are not included. Flags follow current Docker Engine and Kubernetes releases.
Exemple resolt
Searching "logs" returns docker logs -f --tail 100 web, docker compose logs -f service and kubectl logs -f pod -c container --previous, each with a note on what the flags do.
En resum
- Categoria: Desenvolupament i dades
- S'executa al navegador, sense registre, sense pujar res.
- La informació que introdueixes es queda al dispositiu.
- Disponible en anglès.
- Contingut revisat per última vegada:
- Font oficial: Docker CLI reference and Kubernetes kubectl reference
Preguntes freqüents
How do I get a shell in a container?
docker exec -it name sh, or kubectl exec -it pod -- sh in Kubernetes.
How do I see why a pod keeps restarting?
kubectl describe pod and kubectl logs --previous.
How do I roll back a deployment?
kubectl rollout undo deploy/name.
Will docker system prune delete my data?
Not without --volumes; with it, unused volumes and their data are deleted.
Can I export the list?
Yes, as CSV.
Does it cover Helm?
No. It covers docker, docker compose and kubectl.
