{"id":38216134,"url":"https://github.com/nadmax/docker","last_synced_at":"2026-01-28T19:02:47.285Z","repository":{"id":287568727,"uuid":"964997800","full_name":"nadmax/docker","owner":"nadmax","description":"Docker cheatsheet","archived":false,"fork":false,"pushed_at":"2026-01-15T08:56:53.000Z","size":66,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-15T15:16:00.906Z","etag":null,"topics":["devops","docker"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nadmax.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-04-12T07:23:36.000Z","updated_at":"2026-01-15T08:56:57.000Z","dependencies_parsed_at":"2025-04-12T19:17:55.413Z","dependency_job_id":"17354457-8e9f-4adb-9d29-2b99bc109a32","html_url":"https://github.com/nadmax/docker","commit_stats":null,"previous_names":["nadmax/dock-help","nadmax/docker"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nadmax/docker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nadmax%2Fdocker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nadmax%2Fdocker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nadmax%2Fdocker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nadmax%2Fdocker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nadmax","download_url":"https://codeload.github.com/nadmax/docker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nadmax%2Fdocker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28849376,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T15:15:36.453Z","status":"ssl_error","status_checked_at":"2026-01-28T15:15:13.020Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["devops","docker"],"created_at":"2026-01-17T00:48:04.983Z","updated_at":"2026-01-28T19:02:47.276Z","avatar_url":"https://github.com/nadmax.png","language":null,"readme":"# Docker\n**This document is the complete version with each Docker feature explained.**  \n**See the list of features below if you want to see just one that interests you.**\n\n## Docker features\n🟢 [Docker Images](https://github.com/nadmax/dock-help/blob/master/images/README.md)  \n🟢 [Docker Containers](https://github.com/nadmax/dock-help/blob/master/containers/README.md)  \n🟢 [Docker Volumes](https://github.com/nadmax/dock-help/blob/master/storages/volumes/README.md)  \n🟢 [Docker bind mounts](https://github.com/nadmax/dock-help/blob/master/storages/bind/README.md)  \n🟢 [Dockerfile](https://github.com/nadmax/dock-help/blob/master/dockerfile/README.md)  \n🟡 [Docker Networks](https://github.com/nadmax/dock-help/blob/master/networks/README.md)    \n🟡 [Docker Compose](https://github.com/nadmax/dock-help/blob/master/compose/README.md)  \n🔴 Docker Context  \n🔴 Docker System  \n🔴 Docker Swarm\n\n*(🟢 means completed, 🟡 means in progress, 🔴 means not covered)*\n\n## What is Docker?\nDocker is an open-source platform which provides the ability to package and run an application in an isolated environment called container.   \nThanks to the isolation, it allows you to run many containers simultaneously on a given host.  \n\nYou can share containers while you work, it ensures that everyone gets the same container that works in the same way.\n\n## Installation\nThey are two ways to install Docker:  \n- [Docker Desktop](https://www.docker.com/products/docker-desktop/): A user-friendly, all-in-one application for container management.\n- [Docker Engine](https://docs.docker.com/engine/install/): The containerization technology for building and containerizing your applications.\n\n## General commands\n```bash\ndocker -d # Start the docker daemon\ndocker \u003coptional_subcommand\u003e --help # Get help with Docker. Works with subcommand like build, images etc...\ndocker info # Display system-wide information\n```\n\n## Images\nBefore running a container, you need an image of your application.  \n\nA Docker image is a lightweight, standalone, executable package of software that includes everything needed to run an application (code, runtime, system tools, system libraries and settings).  \nOnce an image is created, it can't be modified.  \nYou can only make a new image or add changes on top of it.  \nImages on a container are composed of layers, representing a set of file system changes that add, remove, or modify files.  \n\nHere are some examples of Docker commands related to images:\n```bash\ndocker build -t \u003cimage_name\u003e . # Build an image from a Dockerfile\ndocker build -t \u003cimage_name\u003e . --no-cache # Build an image from a Dockerfile without the cache\ndocker images # List local images\ndocker rmi \u003cimage_name\u003e # Delete an image\ndocker image prune # Remove all unused images\ndocker rmi -f $(docker images -aq) # Delete all images\ndocker inspect \u003cimage_name\u003e # Show low-level image info (in JSON format)\ndocker history \u003cimage_name\u003e # Show the image history by listing its ancestors\ndocker tag \u003crepo_name\u003e/\u003cimage_name\u003e|\u003cimage_name\u003e:\u003ctag_name\u003e # Tag an image\ndocker push \u003crepo_name\u003e/\u003cimage_name\u003e|\u003cimage_name\u003e:\u003ctag_name\u003e # Push an image/repo to a registry\ndocker pull \u003crepo_name\u003e/\u003cimage_name\u003e|\u003cimage_name\u003e:\u003ctag_name\u003e # Pull an image/repo from a registry\ndocker search \u003ctext\u003e # Search an image on the official registry\n```\n\n## Containers\nA container is a runtime instance of a Docker image.  \nA container will always run the same, regardless of the infrastructure.  \n\nThey isolate software from its environment and ensure that it works uniformly despite differences for instance between development and staging.\n\nHere are some examples of Docker commands related to containers:\n```bash\ndocker run --name \u003ccontainer_name\u003e \u003cimage_name\u003e # Create and run a container from an image, with a custom name\ndocker run -p \u003chost_port\u003e:\u003ccontainer_port\u003e --name \u003ccontainer_name\u003e \u003cimage_name\u003e # Create and run a container with a custom name and publish a container's port to the host.\ndocker run -d --name \u003ccontainer_name\u003e \u003cimage_name\u003e # Create and run a container with a custom name, in the background\ndocker start|stop \u003ccontainer_name\u003e|\u003ccontainer_id\u003e # Start or stop an existing container by specifying its name or its ID\ndocker rm \u003ccontainer_name\u003e # Remove a stopped container\ndocker exec -it \u003ccontainer_name\u003e # Open a shell inside a running container\ndocker logs -f \u003ccontainer_name\u003e # Fetch and follow container logs\ndocker container ls # List containers\ndocker container inspect \u003ccontainer_name\u003e|\u003ccontainer_id\u003e # Inspect a running container (in JSON format)\ndocker ps # List currently running containers\ndocker ps -a|--all # List running and stopped containers\ndocker ps -q # Only list container IDs\ndocker container stats # View resource usage stats\ndocker commit \u003ccontainer_name\u003e \u003cimage_name\u003e # Commit a snapshot of the container\n```\n\n## Volumes\nVolumes are persistent data stores for containers.  \nWhen you create a volume (see examples below), it's stored within a directory on the Docker host.  \nWhen you mount the volume into a container (see examples below), this directory is what's mounted into the container.  \nBy default, mounted volumes are read-write volumes but you can mount a volume as read-only.\n\nVolumes are managed by Docker and are isolated from the core functionality of the host machine.\nIf you need to access files or directories from both containers and the host, use bind mounts.\n\nHere are some examples of Docker commands related to volumes:\n```bash\ndocker volume create \u003cvolume_name\u003e # Create a new volume\ndocker volume ls # List volumes\ndocker volume inspect \u003cvolume_name\u003e # Show low-level volume info (in JSON format)\ndocker volume rm \u003cvolume_name\u003e # Delete a volume\ndocker run -d --name \u003ccontainer_name\u003e --mount source=\u003cvolume_name\u003e,target=\u003cdirectory\u003e \u003cimage_name\u003e # Start a detached container with a volume\ndocker run -d --name \u003ccontainer_name\u003e -v \u003csource_volume\u003e:\u003ctarget_directory\u003e \u003cimage_name\u003e # Shortest way to start a detached container with a volume\ndocker run -d --name \u003ccontainer_name\u003e --mount source=\u003cvolume_name\u003e,target=\u003cdirectory\u003e, readonly \u003cimage_name\u003e # Start a detached detached container with a read-only volume\ndocker run -d --name \u003ccontainer_name\u003e -v \u003csource_volume\u003e:\u003ctarget_directory\u003e:ro \u003cimage_name\u003e # Shortest way to start a detached container with a read-only volume\n```\n\n## Bind mounts\nBind mounts create a direct link between a host system path and a container, allowing access to files or directories stored anywhere on the host.\nBy contrast, they aren't isolated by Docker.  \nWhich means, if you specified a mount path that doesn't exist on the host, it will produce an error.  \nBoth non-Docker processes on the host and container processes can modify the mounted files simultaneously.  \n\nUse bind mounts when you need to be able to access files from both the container and the host.\n\nHere are two examples of Docker commands related to bind mounts:\n```bash\ndocker run -d --name \u003ccontainer_name\u003e --mount type=bind,src=\u003chost-path\u003e,dst=\u003ccontainer-path\u003e \u003cimage_name\u003e # Start a detached container with a bind mount\ndocker run -d --name \u003ccontainer_name\u003e --volume \u003chost-path\u003e:\u003ccontainer-path\u003e \u003cimage_name\u003e # Shortest way to start a detached container with a bind mount\n```\n\n## Networks\nNetworking for containers refers to the ability to connect and communicate with each other, or to non-Docker workloads.  \nNetworking is enabled by default, which means they can make outgoing connections.  \nA container only sees a network interface with an IP address, a gateway, a routing table, DNS services, etc...  \n\nYou can create custom networks, and connect multiple containers to the same network.  \nOnce connected to a custom network, containers can communicate with each other using container IP addresses or container names.\n\nHere are some examples of Docker commands related to networks:\n```bash\ndocker network create -d \u003cdriver_type\u003e \u003cnetwork_name\u003e # Create a custom network by specifying driver\ndocker network ls # List networks\ndocker network inspect \u003cnetwork_name\u003e # Show low-level network info (in JSON format)\ndocker network connect \u003cnetwork_name\u003e \u003ccontainer_name\u003e # Connect a container to a network\ndocker network disconnect \u003cnetwork_name\u003e \u003ccontainer_name\u003e # Disconnect a container from a network\ndocker network rm \u003cnetwork_name\u003e # Delete network\ndocker network prune # Delete unused networks\ndocker run -d -v \u003csource_volume\u003e:\u003ctarget_directory\u003e \u003cimage_name\u003e  --name \u003ccontainer_name\u003e --network \u003cdriver_type\u003e \u003cimage_name\u003e # Start a container with a volume mount from a network driver\n```\n\n### Drivers\nDrivers are pluggable interfaces implementing networking functionality for containers.  \nDocker provides built-in network drivers for common use cases, including multi-host networking and encryption.  \n\nHere are a list of some drivers:\n| Driver | Description |\n|----------------|-------------|\n| **Bridge**     | A software device which lets containers connected to the same network, while providing isolation from containers that aren't connected to that network. It is the default network driver if you don't specify one. |\n| **Host**       | Remove network isolation between the container and the Docker host, and use the host's networking directly. \n| **overlay** | Connect multiple Docker daemons together and enable Swarm services and containers to communicate across nodes.\n| **none** | Completely isolate a container from the host and other containers. Not available for Swarm services.\n\n## Dockerfile\nA Dockerfile is a text document containing all the instructions a user could call on the command line to create a Docker image.  \nInstructions are not case-sensitive. However, convention is for them to be uppercase to distinguish them from arguments more easily.\n\nHere's the instructions you can use:\n| Instruction   | Description                                               |\n|---------------|-----------------------------------------------------------|\n| ADD           | Add local or remote files and directories.                |\n| ARG           | Use build-time variables.                                 |\n| CMD           | Specify default commands.                                 |\n| COPY          | Copy files and directories.                               |\n| ENTRYPOINT    | Specify default executable.                               |\n| ENV           | Set environment variables.                                |\n| EXPOSE        | Describe which ports your application is listening on.    |\n| FROM          | Create a new build stage from a base image.               |\n| HEALTHCHECK   | Check a container's health on startup.                    |\n| LABEL         | Add metadata to an image.                                 |\n| ONBUILD       | Specify instructions for when the image is used in a build. |\n| RUN           | Execute build commands.                                   |\n| SHELL         | Set the default shell of an image.                        |\n| STOPSIGNAL    | Specify the system call signal for exiting a container.   |\n| USER          | Set user and group ID.                                    |\n| VOLUME        | Create volume mounts.                                     |\n| WORKDIR       | Change working directory.                                 |\n\n[View the Dockerfile example here](https://github.com/nadmax/dock-help/blob/master/dockerfile/Dockerfile.example)\n\n## Docker Compose\nDocker Compose is a tool for defining and running multi-container applications.  \nCompose simplifies the control of your entire application stack, making it easy to manage services, networks, and volumes in a single YAML configuration file.  \nWith a single command, you can create and start all the services from your configuration file. (see examples of compose commands below)\n\n```bash\ndocker compose up -d # Start all detached services defined in compose.yaml file\ndocker compose down # Stop and remove running services, networks\ndocker compose logs # Monitor running containers output\ndocker compose ps # List all the services with their current status\n```\n\n[View the compose file example here](https://github.com/nadmax/dock-help/blob/master/compose/compose.example.yaml)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnadmax%2Fdocker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnadmax%2Fdocker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnadmax%2Fdocker/lists"}