Check Docker Version
Displays the Docker client version installed on your system, useful for checking compatibility and the environment.
docker --versionForget manual configuration. Copy and paste commands to spin up containers, clean volumes and deploy in record time.
Use this section to check the overall Docker status, installed versions, or get detailed information about the Docker system and resource usage.
Displays the Docker client version installed on your system, useful for checking compatibility and the environment.
docker --versionProvides a detailed summary of Docker system information, including the number of containers (running, paused, stopped), images, volumes, networks, and daemon configurations.
docker infoSimilar to `docker info`, this command can provide a more specific or formatted view of Docker system information, depending on the version and configuration.
docker system infoShows Docker disk space usage, detailing consumption by images, containers, volumes, and build cache, helping to identify where space is being used.
docker system dfDisplays the versions of the Docker client (CLI) and server (daemon), allowing verification of communication and compatibility between them.
docker versionStreams real-time events from the Docker daemon, such as container, image, and volume creation, start, stop, and destruction, useful for continuous monitoring.
docker system eventsDisplays Docker daemon events that occurred in the last hour, useful for reviewing recent system activities and debugging recently emerged issues.
docker system events --since 1hRemoves unused Docker data older than 24 hours, such as stopped containers, untagged images, and build cache, helping to free up space selectively.
docker system prune --filter until=24hUse this section for managing the Docker container lifecycle, from execution and configuration to stopping, removal, and debugging. Essential for deploying and maintaining applications.
Lists all Docker containers that are currently running, showing their IDs, names, images, commands, mapped ports, and status.
docker psLists all Docker containers, including those that are stopped or have exited (`-a` for "all").
docker ps -aLists only the IDs of running Docker containers, useful for chaining commands or automated scripts.
docker ps -qLists running containers with a custom table format, displaying only names, status, and mapped ports, allowing for a cleaner and more focused view.
docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"Runs a new container from the `blueprint-backend` image and maps host port `3001` to container port `3001` (`-p` for "publish"), allowing external access to the service.
docker run -p 3001:3001 blueprint-backendRuns a new container in `detached` mode (background, `-d`), assigns the name `backend` (`--name`), and maps host port `3001` to container port `3001`.
docker run -d --name backend -p 3001:3001 blueprint-backendRuns an `alpine` image container in interactive mode (`-i`) with a pseudo-TTY (`-t`), executing the `sh` command. The container will be automatically removed (`--rm`) upon termination.
docker run -it --rm alpine shRuns an `app` image container and sets the `NODE_ENV` environment variable to `production` (`-e` for "env"), useful for configuring application behavior within the container.
docker run -e NODE_ENV=production appRuns a `node` image container, mounting the host's current working directory (`$(pwd)`) as `/app` inside the container (`-v` for "volume") and setting `/app` as the working directory (`-w`). Then, executes `npm install`.
docker run -v $(pwd):/app -w /app node npm installRuns a container from the `app` image and configures an automatic restart policy (`--restart unless-stopped`), ensuring the container will restart automatically unless explicitly stopped.
docker run --restart unless-stopped appRuns a container from the `app` image and limits the amount of RAM it can use to 256 megabytes (`--memory`), useful for resource control.
docker run --memory="256m" appRuns a container from the `app` image and limits CPU usage to 0.5 (equivalent to 50% of one CPU core) (`--cpus`), useful for resource control.
docker run --cpus="0.5" appSends a SIGTERM signal to the specified container, requesting its graceful shutdown. After a timeout, if the container does not stop, a SIGKILL is sent.
docker stop container_nameStops all running Docker containers, using the output of `docker ps -q` (which lists only the IDs of running containers) as an argument for `docker stop`.
docker stop $(docker ps -q)Removes a specific Docker container. The container must be stopped before being removed, unless the `-f` (force) flag is used.
docker rm container_nameRemoves all Docker containers, both running and stopped, using the output of `docker ps -aq` (which lists all IDs) as an argument for `docker rm`.
docker rm $(docker ps -aq)Restarts a running Docker container, stopping it and starting it again.
docker restart container_namePauses all processes within a running container, temporarily suspending it without terminating it, freeing up CPU resources but retaining memory.
docker pause container_nameUnpauses a container that was previously paused, allowing its processes to resume execution.
docker unpause container_nameForces the immediate stop of a Docker container by sending a SIGKILL signal, without waiting for it to shut down gracefully. Use with caution, as it may result in data loss.
docker kill container_nameUse this section for creating, managing, listing, or cleaning Docker images. Essential for developing and distributing Dockerized applications.
Lists all locally stored Docker images, showing their repositories, tags, IDs, and sizes.
docker imagesLists all Docker images, including intermediate layers (`-a` for "all"), which are typically hidden and can consume space.
docker images -aLists Docker images with a custom table format, displaying repository, tag, and size, for a more organized and focused view.
docker images --format "table {{.Repository}}\t{{.Tag}}\t{{.Size}}"Builds a Docker image from the `Dockerfile` located in the `./backend` directory and tags it with the name `blueprint-backend` (`-t` for "tag").
docker build -t blueprint-backend ./backendBuilds a Docker image from the `Dockerfile` located in the `./frontend` directory and tags it with the name `blueprint-frontend`.
docker build -t blueprint-frontend ./frontendBuilds a Docker image from the `Dockerfile` in the current directory, without using layer cache (`--no-cache`), ensuring all steps are executed from scratch, and tags it as `app:latest`.
docker build --no-cache -t app:latest .Builds a Docker image from the `Dockerfile` in the current directory, using a specific build stage (`--target production`) defined in the multi-stage Dockerfile, and tags it as `app:prod`.
docker build --target production -t app:prod .Builds a Docker image from the `Dockerfile` in the current directory, passing a build argument (`--build-arg NODE_ENV=production`) that can be used within the Dockerfile during the build process, and tags it as `app`.
docker build --build-arg NODE_ENV=production -t app .Builds a Docker image with detailed, plain progress output (`--progress=plain`), useful for debugging in CI/CD environments or when standard output is not a TTY.
docker build --progress=plain -t app .Builds a Docker image and "squashes" the resulting layers into a single layer after the base image, reducing the number of layers and, potentially, the final image size (`--squash`).
docker build --squash -t app .Builds a Docker image and adds a `version=1.0` label (`--label`) to the image, useful for metadata, organization, and filtering.
docker build --label version=1.0 -t app .Removes a specific Docker image from local storage. The image cannot be in use by any container to be removed.
docker rmi image_nameRemoves all unused Docker images, using the output of `docker images -q` (which lists only image IDs) as an argument for `docker rmi`.
docker rmi $(docker images -q)Removes Docker images that are not associated with any container and have no tags (dangling or orphaned images), freeing up disk space.
docker image pruneRemoves all unused Docker images, including intermediate layers (`-a` for "all"), which are not referenced by any named image.
docker image prune -aCreates a new tag (`target:1.0`) for an existing image (`source:latest`), allowing the same image to be referenced with different names or specific versions.
docker tag source:latest target:1.0Pushes a Docker image to a remote registry (`registry.com/app:latest`), making it available to other users or systems.
docker push registry.com/app:latestDownloads a Docker image from a remote registry (`registry.com/app:latest`) to your system's local storage.
docker pull registry.com/app:latestUse this section for debugging, monitoring performance, or analyzing issues in Docker containers through logs and real-time statistics.
Displays the standard log output (stdout/stderr) of a specific Docker container, useful for debugging and monitoring.
docker logs container_nameDisplays container logs in real-time, following new entries (`-f` for "follow"), keeping the connection open and showing logs as they are generated.
docker logs -f container_nameDisplays the last 50 log lines of a specific container (`--tail`), useful for a quick check of recent events without loading the entire history.
docker logs --tail 50 container_nameDisplays container logs generated in the last 2 hours (`--since`), allowing logs to be filtered by time period to focus on recent events.
docker logs --since="2h" container_nameDisplays container logs, adding a timestamp to each log line (`--timestamps`), which is useful for chronological analysis and event correlation.
docker logs --timestamps container_nameDisplays a real-time stream of resource usage statistics (CPU, memory, network, disk I/O) for all running containers, useful for performance monitoring and bottleneck identification.
docker statsDisplays real-time resource usage statistics for a specific Docker container, allowing focus on the performance of a single service.
docker stats container_nameDisplays processes running inside a specific Docker container, similar to the Linux `top` command, useful for debugging and checking which processes are active.
docker top container_nameDisplays a static snapshot of resource usage statistics for running containers, without the continuous real-time stream (`--no-stream`), useful for point-in-time captures.
docker stats --no-streamDisplays container resource usage statistics with a custom table format, showing the container name and CPU usage percentage, for a concise view.
docker stats --format "table {{.Container}}\t{{.CPUPerc}}"Streams real-time events from the Docker daemon, such as creation, start, stop, and destruction of containers, images, and volumes, useful for auditing and automation.
docker eventsDisplays detailed low-level information about a specific Docker container in JSON format, including network configurations, volumes, status, metadata, and event history.
docker inspect container_nameDisplays detailed low-level information about a specific Docker image in JSON format, including layers, metadata, port configurations, and environment variables.
docker inspect image_nameUse this section to interact directly with running containers, execute commands inside them, copy files between host and container, or manage port mappings and networks.
Executes the `bash` command inside a running Docker container, allocating a pseudo-TTY (`-t`) and keeping standard input open (`-i`) for interaction, allowing access to the container's shell.
docker exec -it container_name bashExecutes the `sh` (basic shell) command inside a running Docker container in interactive mode with pseudo-TTY, useful when `bash` is not available in the container.
docker exec -it container_name shExecutes a specific command (`ls -la /app`) inside a running Docker container, without needing shell interaction.
docker exec container_name ls -la /appCopies the `file.txt` file from the host to the `/app/` directory inside the specified container (`container_name`).
docker cp file.txt container_name:/app/Copies the `logs` directory from inside the specified container (`container_name:/app/logs`) to the local `./logs` directory on the host.
docker cp container_name:/app/logs ./logsDisplays port mappings for a specific Docker container, showing which host ports are connected to which container ports.
docker port container_nameRuns a container from the `nginx` image and maps host port `8080` to container port `80` (`-p` for "publish"), allowing web server access.
docker run -p 8080:80 nginxRuns an `nginx` image container and automatically maps all ports exposed in the container's `Dockerfile` to random, unused ports on the host (`-P` for "publish all").
docker run -P nginxExecutes the `bash` command inside a running container as the `root` user (`-u`), useful for administrative tasks requiring elevated privileges.
docker exec -u root container bashExecutes the `sleep 60` command inside a running container in `detached` mode (background, `-d`), without blocking the current terminal.
docker exec -d container sleep 60Executes a command (`cmd`) inside a running container, passing an environment variable (`--env VAR=value`) that will only be available for the execution of that command.
docker exec -it container --env VAR=value cmdUse this section to free disk space, remove unused Docker resources, or clean the Docker environment to maintain efficiency.
Removes all unused Docker data, including stopped containers, unused networks, and dangling images, but not volumes by default.
docker system pruneRemoves all unused Docker data, including stopped containers, unused networks, dangling images, and all untagged images (`-a` for "all").
docker system prune -aRemoves all unused Docker data, including volumes not referenced by any container (`--volumes`), as well as stopped containers, networks, and dangling images.
docker system prune --volumesRemoves all stopped Docker containers, freeing up resources and disk space.
docker container pruneRemoves Docker images that are not associated with any container and have no tags ("dangling" or "orphan" images).
docker image pruneRemoves all Docker volumes not in use by any container, freeing up disk space. Use with caution to avoid data loss.
docker volume pruneRemoves all Docker networks not in use by any container, freeing up network resources.
docker network pruneDisplays detailed Docker disk space usage (`-v` for "verbose"), showing more granular information about the consumption of each resource type.
docker system df -vDisplays Docker daemon events, filtering only events related to containers (`--filter type=container`), useful for monitoring specific activities.
docker system events --filter type=containerClears the Docker build cache, removing unused intermediate layers, which can free up disk space and resolve build issues.
docker builder pruneDisplays a summary of disk space usage by Docker, detailing consumption by images, containers, volumes, and build cache.
docker system dfLists Docker images with a custom table format, displaying repository, tag, and size, for a quick analysis of space occupied by images.
docker images --format "table {{.Repository}}\t{{.Tag}}\t{{.Size}}"Use this section for multi-container applications or development environments using Docker Compose to orchestrate services. Covers basic commands to advanced configurations and CI/CD integration.
Displays the installed Docker Compose version, useful for checking compatibility and available features.
docker-compose --versionBuilds, (re)creates, starts, and attaches to containers for all services defined in the `docker-compose.yml` file, running in the foreground and displaying logs.
docker-compose upBuilds, (re)creates, starts, and attaches to containers for all services defined in the `docker-compose.yml` file, running in `detached` (background) mode.
docker-compose up -dStarts only the `backend` service and its dependencies defined in the `docker-compose.yml` file.
docker-compose up backendBuilds service images before starting containers, ensuring that images are updated with the latest changes in the `Dockerfile`.
docker-compose up --buildRecreates all containers, even if there are no changes in configuration or image, useful for troubleshooting or applying new configurations.
docker-compose up --force-recreateRemoves service containers no longer defined in the `docker-compose.yml` file (orphans) upon startup, cleaning the environment.
docker-compose up --remove-orphansStarts a specific service without starting its dependencies, useful for testing a component in isolation.
docker-compose up --no-depsSets a 30-second timeout for graceful container shutdown when stopping or restarting services during `up`.
docker-compose up --timeout 30Stops and removes containers, networks, and default volumes created by `docker-compose up`.
docker-compose downStops and removes containers, networks, and also named volumes defined in the `docker-compose.yml` file (`-v` for "volumes").
docker-compose down -vStops the containers for services defined in `docker-compose.yml`, but does not remove them, allowing them to be restarted later with `docker-compose start`.
docker-compose stopStops only the `backend` service container defined in `docker-compose.yml`.
docker-compose stop backendStops and removes containers, networks, and also images created by the services (`--rmi all`), freeing up more disk space.
docker-compose down --rmi allSets a 10-second timeout for graceful container shutdown when stopping services with `down`.
docker-compose down --timeout 10Removes stopped containers without prompting for confirmation (`-f` for "force").
docker-compose rm -fStops and removes containers, networks, and also any containers that are no longer referenced in the `docker-compose.yml` file.
docker-compose down --remove-orphansDisplays the consolidated log output of all services defined in `docker-compose.yml`.
docker-compose logsDisplays the log output of all services in real-time, following new entries (`-f` for "follow"), keeping the connection open.
docker-compose logs -fDisplays the log output only for the `backend` service.
docker-compose logs backendExecutes the `bash` command inside the `backend` service container, allowing interactive access to the container's shell.
docker-compose exec backend bashExecutes a specific command (`cargo build`) inside the `backend` service container.
docker-compose exec backend cargo buildDisplays the last 50 lines of the `backend` service log.
docker-compose logs --tail 50 backendDisplays the logs of the `backend` service generated in the last hour.
docker-compose logs --since="1h" backendExecutes the `ls -la` command inside the `backend` service container without allocating a pseudo-TTY (`-T`), useful for automated scripts or when output does not require interactive formatting.
docker-compose exec -T backend ls -laExecutes the `bash` command inside the `backend` service container as the `root` user (`-u`), useful for administrative tasks requiring elevated privileges.
docker-compose exec -u root backend bashBuilds images for all services that have a `build` defined in `docker-compose.yml`.
docker-compose buildBuilds the image only for the `backend` service.
docker-compose build backendBuilds service images without using layer cache, ensuring a clean and fresh build, useful for resolving cache issues.
docker-compose build --no-cacheStarts services in `detached` mode and scales the `backend` service to 3 instances, useful for load balancing or performance testing.
docker-compose up -d --scale backend=3Pulls the latest images for all services defined in `docker-compose.yml` from their respective repositories.
docker-compose pullValidates and displays the effective configuration of `docker-compose.yml` (and override files), useful for debugging the configuration before starting services.
docker-compose configLists all containers created by Docker Compose, showing their status, ports, and names, similar to `docker ps` but focused on Compose services.
docker-compose psBuilds images for multiple services in parallel, speeding up the build process for projects with many services.
docker-compose build --parallelBuilds images with detailed progress output and no special formatting, useful for CI/CD environments or logs.
docker-compose build --progress=plainStarts services and scales multiple services simultaneously, for example, `web` to 2 instances and `db` to 1 instance, in a single operation.
docker-compose up --scale web=2 --scale db=1Executes a one-off command in a new `backend` service container, passing an environment variable `VAR` with the value `value` inline.
docker-compose run --env VAR=value backendExecutes a one-off command in a new `backend` service container, loading environment variables from a specific `.env` file.
docker-compose run --env-file .env backendDisplays only the names of services defined in the `docker-compose.yml` configuration, useful for scripts or automation.
docker-compose config --servicesStarts services using environment variables defined in a specific `prod.env` file, overriding or complementing those from the default `.env` file, for different environments.
docker-compose --env-file prod.env upExecutes the `env` command inside a new `backend` service container and removes it (`--rm`) after execution, to list the environment variables available to the service.
docker-compose run --rm backend envExecutes the `printenv` command inside the *running* `backend` service container to list its environment variables.
docker-compose exec backend printenvStarts services under a specific project name (`--project-name projeto`), which affects the names of created containers, networks, and volumes, useful for isolating environments.
docker-compose --project-name projeto upStarts services in `detached` mode, specifying the `local` volume driver for volumes defined in the services. Generally, the driver is configured directly in `docker-compose.yml`.
docker-compose up -d --volume-driver localExecutes the `ls /data` command inside the `backend` service container to list the content of a volume mounted at `/data`.
docker-compose exec backend ls /dataExecutes the `ls /shared` command in a new `backend` service container (which is removed after execution) to list the content of a shared volume mounted at `/shared`.
docker-compose run --rm backend ls /sharedThis command does not directly add a network alias via `up`. Network aliases for services are defined within the service's network configuration in the `docker-compose.yml` file to allow other services to find it by that name.
docker-compose up --network-alias webExecuta o comando `ping database` dentro do container do serviço `backend` para testar a conectividade de rede com o serviço `database`.
docker-compose exec backend ping databaseStops and removes containers, networks, and all named volumes defined in the `docker-compose.yml` file.
docker-compose down --volumesLists all Docker volumes and filters those containing the project name (`projeto`), useful for identifying volumes created by Docker Compose.
docker volume ls | grep projetoLists all Docker networks and filters those containing the project name (`projeto`), useful for identifying networks created by Docker Compose.
docker network ls | grep projetoStarts the `backend` service without starting its dependencies, useful for isolating and testing a single service.
docker-compose up --no-deps backendRecreates the containers of a specific service without starting its dependencies, useful for forcing a recreation without affecting other services.
docker-compose up --force-recreate --no-depsRestarts the `backend` service container.
docker-compose restart backendRestarts all service containers defined in `docker-compose.yml`.
docker-compose restartPauses the `backend` service container, suspending its processes without terminating it.
docker-compose pause backendDespausa o container do serviço `backend` que foi previamente pausado.
docker-compose unpause backendForces the immediate stop of the `backend` service container by sending a SIGKILL signal, without waiting for a graceful shutdown.
docker-compose kill backendReduces the number of instances of the `backend` service to zero, effectively stopping and removing all containers associated with it.
docker-compose up --scale backend=0Starts services using an alternative `docker-compose` file (`docker-compose.prod.yml`) instead of the default, useful for different environments (production, development).
docker-compose -f docker-compose.prod.yml upStarts services by combining configurations from multiple `docker-compose` files, where the second file (`override.yml`) can overwrite or extend the first.
docker-compose -f docker-compose.yml -f docker-compose.override.yml upActivates compatibility mode, which attempts to convert Compose `deploy` options to Docker `run` options, useful for compatibility with Docker Swarm.
docker-compose --compatibility upStarts services and displays detailed output (`--verbose`) of what Docker Compose is doing, useful for debugging startup issues.
docker-compose --verbose upStarts services, disabling ANSI (color) output in the terminal (`--no-ansi`), useful for logs in systems that do not interpret color codes or for logging to files.
docker-compose --no-ansi upStarts services belonging to the `dev` profile (`--profile`), allowing activation/deactivation of service groups based on environment or purpose.
docker-compose --profile dev upStarts services belonging to the `dev` AND `test` profiles, activating multiple service groups simultaneously.
docker-compose --profile dev --profile test upValidates and displays the `docker-compose.yml` configuration, resolving and substituting all environment variables with their current values, useful for checking the final configuration.
docker-compose config --resolve-env-varsStarts the services defined in `docker-compose.test.yml` and stops all other containers if one exits (`--abort-on-container-exit`), ideal for automated testing environments where a test failure should stop everything.
docker-compose -f docker-compose.test.yml up --abort-on-container-exitStarts the services defined in `docker-compose.ci.yml`, rebuilding the images, for a Continuous Integration (CI) environment ensuring the environment is always up-to-date.
docker-compose -f docker-compose.ci.yml up --buildExecutes the `npm test` command in a new `backend` service container and removes it (`--rm`) after execution, ideal for running unit or integration tests in isolation.
docker-compose run --rm backend npm testExecutes the `flake8` lint tool in a new `backend` service container and removes it (`--rm`) after execution, for static Python code analysis.
docker-compose run --rm backend flake8 .Executes the `python manage.py migrate` command in a new `backend` service container and removes it (`--rm`) after execution, to apply database migrations in Django applications.
docker-compose run --rm backend python manage.py migrateExecutes the `python manage.py collectstatic` command inside the running `backend` service container to collect static files in Django applications.
docker-compose exec backend python manage.py collectstaticFirst, stops and removes all services and their networks (`down`), then starts them again, rebuilding the images (`up --build`), useful for a complete development environment "reset".
docker-compose down && docker-compose up --buildDisplays the Docker Compose V2 version, which is integrated into the Docker client (the `compose` command is a `docker` subcommand).
docker compose versionStarts the services defined in the `docker-compose.yml` file using the Docker Compose V2 syntax.
docker compose upMonitors the file system and automatically restarts or rebuilds services when changes are detected, useful for local development with instant feedback.
docker compose watchAttempts to convert a `docker-compose.yml` file from V1 to V2 syntax, useful for migration. (Alpha command, subject to change).
docker compose alpha convertValidates and displays the effective `docker-compose.yml` configuration in JSON format, useful for programmatic processing or integration with other tools.
docker compose config --format jsonExecutes the `bash` command in a new `backend` service container (V2) and removes it (`--rm`) after execution.
docker compose run --rm backend bashStarts the services and waits until all containers are healthy (healthcheck) before considering the command complete, useful in CI/CD scripts to ensure the application is ready.
docker compose up --waitStarts the services and attaches to the logs of all services, including their dependencies, useful for observing the complete application startup and debugging inter-service initialization issues.
docker compose up --attach dependenciesCopies files or directories from inside the `backend` service container to a local directory on the host, using Docker Compose V2 syntax.
docker compose cp backend:/app ./localStops and removes services with a 30-second timeout for graceful shutdown, using Docker Compose V2 syntax.
docker compose down --timeout 30Use this section for configuring communication between containers, managing data persistence, or isolating network environments in Docker.
Lists all Docker networks on the system, showing their IDs, names, drivers, and scopes, useful for understanding network topology.
docker network lsDisplays detailed low-level information about the Docker `bridge` network in JSON format, including connected containers, IP configurations, and options.
docker network inspect bridgeCreates a new Docker network named `blueprint-net` using the `bridge` driver, allowing containers connected to it to communicate easily by name.
docker network create --driver bridge blueprint-netRemoves a specific Docker network. The network must be empty (no connected containers) to be removed.
docker network rm network_nameLists all locally stored Docker volumes, showing their names and drivers, useful for managing data persistence.
docker volume lsDisplays detailed low-level information about a specific Docker volume in JSON format, including its driver, mount point, and options.
docker volume inspect volume_nameRemoves a specific Docker volume. The volume cannot be in use by any container. Use with caution to avoid data loss.
docker volume rm volume_nameRuns an `alpine` image container and mounts a named volume (`nome_volume`) to the `/data` directory inside the container, ensuring data persistence.
docker run -v nome_volume:/data alpineExecutes the `ping container2` command inside `container1` to test network connectivity between two containers on the same Docker network.
docker exec -it container1 ping container2Executes the `curl` command inside the `frontend` container to test the accessibility and health status of an API in the `backend` container on port `3001`.
docker exec frontend curl http://backend:3001/healthConnects an existing Docker container to a specific Docker network (in this case, the `bridge` network), allowing it to communicate with other containers on that network.
docker network connect bridge containerDisconnects a Docker container from a specific network (in this case, the `bridge` network), isolating it from that network.
docker network disconnect bridge containerCreates a new Docker named volume `data`, which can be used to persist data between containers or between the host and containers, regardless of the container's lifecycle.
docker volume create --name dataUse this section when encountering issues with containers, networks, Docker installation, or performance. Contains commands to check status, diagnose common problems, and access system logs.
Checks the Docker client and server (daemon) versions, useful for confirming if Docker is installed and if the daemon is responding.
docker versionChecks the status of the Docker service on Linux using `systemctl`, showing if the daemon is active, running, and any recent system log messages.
systemctl status dockerChecks the status of the Docker service on Windows using `Get-Service` (PowerShell), showing if the service is running.
Get-Service dockerAdds the current user (`$USER`) to the `docker` group on Linux, granting permissions to run Docker commands without `sudo`. Requires logout/login or `newgrp docker` to apply.
sudo usermod -aG docker $USERChanges the primary group of the current shell to `docker`, applying group permissions without needing to log out and log in again. Useful after adding the user to the docker group.
newgrp dockerDisplays a summary of Docker disk space usage, detailing consumption by images, containers, volumes, and build cache, useful for diagnosing space issues.
docker system dfRemoves all unused Docker data, including stopped containers, unused networks, dangling images, and all untagged images (`-a` for "all"), freeing up maximum possible space.
docker system prune -aLists all Docker networks on the system, showing their IDs, names, drivers, and scopes, useful for diagnosing connectivity issues between containers.
docker network lsDisplays detailed low-level information about the Docker `bridge` network in JSON format, including connected containers and IP configurations, crucial for network debugging.
docker network inspect bridgeDisplays Docker service logs on Linux using `journalctl`, useful for debugging issues with the Docker daemon itself, such as startup failures or internal errors.
journalctl -u docker.serviceDisplays Docker-related event logs on Windows using `Get-EventLog` (PowerShell), useful for debugging issues with the operating system or the Docker service.
Get-EventLog -LogName Application -Source DockerLists all available Docker contexts, which allow easily switching between different Docker hosts (local, remote, cloud), useful for checking which environment is targeted by commands.
docker context lsChanges the active Docker context to `my-context`, directing subsequent Docker commands to the host or environment defined in that context. Essential when working with multiple Docker environments.
docker context use my-contextVerifies the trust signature of a specific Docker image, ensuring that the image has not been tampered with and comes from a trusted source, important for security.
docker trust inspect image:tag