↑ ↓ select, Enter open, Esc close

#docker

25 one-liners with this tag.

All one-liners tagged docker

Back up a Docker volume to a tar archive

#docker run --rm -v app_data:/data:ro -v /root/docker-backup:/backup alpine tar czf /backup/app_data.tar.gz -C /data .
cautionDocker

Change the restart policy of a Docker container

#docker update --restart unless-stopped app
cautionDocker

Clean up unused Docker data

#docker system prune
cautionDocker

Copy a file from a Docker container to the host

#docker cp app:/etc/nginx/nginx.conf /root/nginx.conf
cautionDocker

Find unhealthy Docker containers

#docker ps --filter health=unhealthy
harmlessDocker

Follow Docker container logs live

#docker logs -f --tail 100 app
harmlessDocker

Follow the logs of all services in a Compose stack

#docker compose -f /opt/app/compose.yaml logs -f --tail 100
harmlessDocker

Get the IP address of a Docker container

#docker inspect app | grep '"IPAddress"'
harmlessDocker

List all Docker containers including stopped ones

#docker ps -a
harmlessDocker

List unused Docker volumes

#docker volume ls --filter dangling=true
harmlessDocker

Open a shell in a running Docker container

#docker exec -it app sh
harmlessDocker

Remove a Docker Compose stack including its volumes

#docker compose -f /opt/app/compose.yaml down -v
destructiveDocker

Remove all unused Docker data including volumes

#docker system prune -a --volumes
destructiveDocker

Remove dangling Docker images

#docker image prune
cautionDocker

Show CPU and memory usage of Docker containers

#docker stats --no-stream
harmlessDocker

Show Docker container logs for a time range

#docker logs -t --since 2h --until 1h app
harmlessDocker

Show Docker disk usage by images, containers and volumes

#docker system df -v
harmlessDocker

Show the disk usage of Docker containers

#docker ps -a --size
harmlessDocker

Show the environment variables of a Docker container

#docker exec app env
harmlessDocker

Show the processes running in a Docker container

#docker top app
harmlessDocker

Show the published ports of a Docker container

#docker port app
harmlessDocker

Show the status of Docker Compose services

#docker compose -f /opt/app/compose.yaml ps -a
harmlessDocker

Stop and remove a Docker Compose stack

#docker compose -f /opt/app/compose.yaml down
cautionDocker

Update Docker Compose images and recreate containers

#docker compose -f /opt/app/compose.yaml pull && docker compose -f /opt/app/compose.yaml up -d
cautionDocker

Validate a Docker Compose file

#docker compose -f /opt/app/compose.yaml config --quiet && echo "Konfiguration OK"
harmlessDocker

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.