October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk10 min

Docker Cheat Sheet: Essential Commands for 2026

Learn the essential Docker commands for building images, running and debugging containers, publishing ports, persisting data, connecting services and managing Compose applications in 2026.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

This Docker cheat sheet covers the commands you need to discover your installation, download and build images, create and operate containers, publish ports, persist data, connect services, and run Compose applications. The key distinction is simple: docker run creates and starts a new container, while docker start starts a container that already exists. Use the examples as templates, replacing uppercase values with your own names.

Docker’s command-line model

Docker has separate resources with separate lifecycles. An image is an immutable package used as a template. A container is a runnable instance of an image. A volume stores data outside a container’s writable layer. A network provides connectivity and service discovery. Docker Compose groups containers, networks and volumes into an application described by a Compose file.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Most commands follow the pattern docker <object> <action>, although common shortcuts such as docker ps and docker run remain widely used. Every installed command can show its own options with --help.

How to check Docker and get built-in help

Run these commands before troubleshooting an unfamiliar machine:

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.
docker --version
docker version
docker info
docker <command> --help
  • docker --version prints the client version in a compact form.
  • docker version reports client and server (engine) versions, which helps identify a client–daemon mismatch.
  • docker info shows engine storage, cgroup, runtime and resource details. It also confirms whether the CLI can reach the daemon.
  • docker container --help, docker image --help and similar forms list subcommands and accepted flags.

If a command returns a permission or daemon-connection error, fix that installation or service issue first; image and container commands cannot work until the client can reach a running Docker engine.

Essential image commands

Images are the starting point for containers. Pull a published image, inspect local images, build your own, add tags, and push tags to a registry.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
docker pull IMAGE[:TAG]
docker images
docker image ls
docker build -t NAME:TAG .
docker image build -f Dockerfile -t NAME:TAG .
docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]
docker push NAME:TAG
docker image inspect IMAGE
Command Purpose Important behavior
docker pull Downloads an image from its registry. If no tag is supplied, Docker uses the registry’s default tag; specify a tag when repeatability matters.
docker build -t Builds an image from a Dockerfile and build context. The final . is the context directory sent to the builder.
docker tag Adds another repository:tag reference to an existing image. Tagging does not create a second copy of the image layers.
docker push Uploads a tagged image to a registry. You must authenticate to a private registry and use a tag that points to that registry.
docker image inspect Displays configuration, layers, architecture and metadata. Use it to verify an image’s entrypoint, environment and platform before running it.

How to build an image with the right controls

The basic build is:

docker build -t myapp:1.0 .

Use these options when the default build is not sufficient:

  • --file PATH (or -f PATH) selects a Dockerfile with a different name or location: docker build --file Dockerfile.prod -t myapp:prod ..
  • --pull checks the registry for a newer version of every referenced base image instead of relying only on a local copy.
  • --no-cache rebuilds instructions without reusing cached layers. This is useful when a stale package index or copied file is suspected, but it usually makes builds slower.
  • --platform linux/amd64 or another platform requests a target architecture. Confirm that the base image and any native dependencies support it.
  • --target STAGE stops at a named stage in a multi-stage Dockerfile, which is useful for producing a development or debugging image.

Keep the build context small with a suitable .dockerignore. A large context slows transfers and can accidentally include credentials or generated files. Use a deterministic tag such as a release number or commit identifier rather than relying on an ambiguous local tag.

How to create, start, stop and remove containers

docker run creates a new container from an image and starts it. If the image is not local, Docker pulls it first. The shortest form is:

docker run --name NAME IMAGE

A detached web container with a published port looks like this:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.
docker run -d --name web -p 8080:80 IMAGE

Use these lifecycle commands:

docker ps
docker ps -a
docker start CONTAINER
docker stop CONTAINER
docker restart CONTAINER
docker kill CONTAINER
docker rm CONTAINER
docker logs CONTAINER
docker logs -f CONTAINER
docker inspect CONTAINER
docker stats CONTAINER
Command Creates a new container? What it does
docker run Yes Creates and starts a container from an image; options such as ports, mounts, environment and networks apply at creation time.
docker start No Starts an existing stopped container with its original configuration.
docker stop No Requests a graceful stop, allowing the process to handle the termination signal.
docker kill No Immediately sends a kill signal when graceful stopping is not working.
docker rm No Removes a stopped container. Its writable layer is deleted; mounted volumes are separate resources.

docker ps lists running containers only. Add -a to include containers that exited or were stopped. If you need a different port, mount or environment setting, do not use start; remove the old container and run a new one with the desired options.

How to publish ports safely

Use -p HOST_PORT:CONTAINER_PORT to publish a container port on the host:

docker run -p 8080:80 IMAGE

This exposes container port 80 through host port 8080. To keep a development service reachable only from the local machine, bind the host address explicitly:

docker run -p 127.0.0.1:8080:80 IMAGE

Publishing is not the same as making an application listen. The process inside the container must listen on the container port, and many web servers must listen on 0.0.0.0 rather than only on 127.0.0.1 inside the container. If the host port is already occupied, choose another host port or stop the conflicting process.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How to mount data with volumes, bind mounts and tmpfs

Docker’s explicit --mount syntax makes the mount type and paths visible:

docker run --mount type=bind,src=$PWD,dst=/app IMAGE
docker run --mount type=volume,src=DATA,dst=/var/lib/data IMAGE
docker run --mount type=tmpfs,dst=/run/cache IMAGE

Bind mounts

A bind mount maps a specific host directory or file into the container. It is convenient for source-code development because edits on the host appear immediately in the container. The host path must exist (or be handled according to the engine’s platform rules), and permissions are those of the host filesystem.

Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

Named volumes

A named volume is managed by Docker and is a better default for database or application data that should survive container replacement:

docker volume create DATA
docker volume ls
docker volume inspect DATA
docker volume rm DATA
docker run --mount type=volume,src=DATA,dst=/var/lib/data IMAGE

Removing a container does not remove a named volume unless you explicitly remove the volume or use a higher-level teardown command with volume deletion.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Tmpfs mounts

A tmpfs mount stores files in memory and disappears when the container stops. It can suit short-lived caches or sensitive temporary data, but it consumes host memory and is not persistent.

The older -v or --volume form remains supported, but --mount is clearer for scripts because each setting is named.

How to enter a running container and move files

Use docker exec for a command in an already-running container:

docker exec -it CONTAINER sh
docker exec -it CONTAINER bash
docker exec CONTAINER COMMAND

-i keeps standard input open and -t allocates a terminal. Use sh when the image does not include Bash. An interactive shell changes the live container only; it does not update the image or recreate the container.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.

Copy files in either direction with:

docker cp CONTAINER:/path ./local-path
docker cp ./local-path CONTAINER:/path

docker commit CONTAINER IMAGE:TAG can capture a container’s current filesystem as an image, but it is rarely suitable for repeatable production builds. Put package installation, configuration and application files in a Dockerfile or Compose definition instead.

How to connect containers with Docker networks

List and manage networks with:

docker network ls
docker network create APP-NET
docker network inspect APP-NET
docker network connect APP-NET CONTAINER
docker network disconnect APP-NET CONTAINER
docker network rm APP-NET

Run related containers on a user-created network:

docker run -d --network APP-NET --name api API-IMAGE
docker run -d --network APP-NET --name worker WORKER-IMAGE

Containers on the same user-created bridge network can resolve one another by container name. An application can therefore connect to api rather than a changing container IP. Inspect the network when a connection fails; check that both containers are attached, the destination process is listening on the expected internal port, and the application uses the container name rather than localhost.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Docker Compose commands for multi-container applications

Compose defines and runs multi-container applications from a YAML file, normally named compose.yaml or docker-compose.yml. Check the plugin and validate the fully merged configuration:

docker compose version
docker compose config

Common lifecycle commands are:

docker compose pull
docker compose build
docker compose up
docker compose up -d
docker compose ps
docker compose logs -f SERVICE
docker compose exec SERVICE COMMAND
docker compose restart SERVICE
docker compose stop
docker compose down
docker compose down -v

Normal startup and observation

Use docker compose up -d for the normal application lifecycle. It creates and starts the declared services in the background. Add --build when images should be rebuilt before startup: docker compose up -d --build. Use docker compose ps to see service state, docker compose logs -f SERVICE to follow one service, and docker compose exec SERVICE COMMAND to run a command in an existing service container.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Build and pull controls

docker compose build builds services that have a build context. Current Compose versions support controls including --no-cache, --pull, --push, --sbom, --provenance and --with-dependencies. Use the options that match your release or supply-chain requirements rather than adding them indiscriminately.

Stopping versus tearing down

docker compose stop stops service containers but leaves the application’s containers, network and volumes available for another up. docker compose down stops and removes the project’s containers and default network. Add -v only when you also intend to remove named volumes declared by the project; that can permanently delete database data.

docker compose up versus docker compose run

Command Best use Ports and lifecycle
docker compose up Start the complete application or selected services. Creates the declared service containers, networks and dependencies; publishes configured service ports.
docker compose run --rm SERVICE COMMAND Run a one-off migration, test, shell or administrative task using a service definition. Creates a temporary container and removes it after completion with --rm. Configured service ports are not published by default.

For a one-off task that must expose the service’s configured ports, add --service-ports:

docker compose run --rm --service-ports SERVICE COMMAND

Choose up when you want the application running as a set of services; choose run when the command is an isolated job that should not replace or alter the long-running service container.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Compose networking and service names

Compose normally creates one default network for each application project. Every service container joins that network and can reach another service by its service name. A database connection therefore uses a hostname such as db, not a hard-coded container IP.

For segmentation, declare named networks in the Compose file, such as a front-tier network for a proxy and application and a back-tier network for the application and database. Attach each service only to the networks it needs. This keeps routing intentional while preserving service-name discovery within each shared network.

Cleanup commands and what they delete

Inspect disk usage before deleting anything:

docker system df
docker system prune
docker container prune
docker image prune
docker volume prune
docker network prune
docker events
docker inspect CONTAINER_OR_IMAGE
  • docker container prune removes stopped containers.
  • docker image prune removes unused image data according to the command’s filters.
  • docker volume prune can delete volumes that are not currently attached; treat it as a data-loss operation.
  • docker network prune removes unused networks.
  • docker system prune combines several cleanup categories. Read its confirmation summary and use filters when available.

Do not use a broad prune command as the first response to a failed deployment. Identify the stopped container with docker ps -a, read its logs, inspect its mounts and environment, and remove only resources you have confirmed are disposable.

A practical troubleshooting sequence

The container exits immediately

  1. List stopped containers with docker ps -a.
  2. Read the reason and application output with docker logs CONTAINER.
  3. Inspect the configured command, entrypoint and environment with docker inspect CONTAINER.
  4. If the image is correct but the command is wrong, recreate the container with a corrected docker run command; docker start cannot change creation-time settings.

The service is running but unreachable

  1. Confirm the container is running with docker ps.
  2. Verify the host-to-container mapping in the original run command or Compose configuration.
  3. Check that the process listens on the container port and on the appropriate interface.
  4. For container-to-container traffic, verify a shared user-created network or Compose network and use the service/container name as the hostname.

Data disappeared after replacement

  1. Check whether the data path was a named volume, bind mount or only the container’s writable layer.
  2. Use docker volume ls and docker volume inspect DATA to locate a named volume.
  3. Recreate the container with the same volume mapping. Do not run docker compose down -v or docker volume prune until backups and retention requirements are confirmed.

Choosing the right command at a glance

Need Use
Get an image that already exists in a registry docker pull IMAGE[:TAG]
Create an image from a Dockerfile docker build -t NAME:TAG .
Create and start a fresh container docker run ... IMAGE
Restart a stopped container unchanged docker start CONTAINER
Run a command inside a running container docker exec -it CONTAINER COMMAND
Run the declared multi-service application docker compose up -d
Run a temporary Compose task docker compose run --rm SERVICE COMMAND
Stop and remove a Compose application docker compose down

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.