> For the complete documentation index, see [llms.txt](https://tingreavinash.gitbook.io/the-tech-toolbox/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tingreavinash.gitbook.io/the-tech-toolbox/notes/docker/commands.md).

# Commands

#### Container Management

1. List running containers: `docker ps`
2. List all containers (running and stopped): `docker ps -a`
3. Start a container: `docker start [CONTAINER_NAME/CONTAINER_ID]`
4. Stop a container: `docker stop [CONTAINER_NAME/CONTAINER_ID]`
5. Restart a container: `docker restart [CONTAINER_NAME/CONTAINER_ID]`
6. Remove a container: `docker rm [CONTAINER_NAME/CONTAINER_ID]`
7. Pause a container: `docker pause [CONTAINER_NAME/CONTAINER_ID]`
8. Unpause a container: `docker unpause [CONTAINER_NAME/CONTAINER_ID]`
9. Inspect a container: `docker inspect [CONTAINER_NAME/CONTAINER_ID]`

#### Image Management

1. List local Docker images: `docker images`
2. Download a Docker image: `docker pull [IMAGE_NAME]`
3. Create a Docker image from a Dockerfile: `docker build -t [IMAGE_NAME] [DOCKERFILE_PATH]`
4. Remove a Docker image: `docker rmi [IMAGE_NAME/IMAGE_ID]`
5. Tag a Docker image: `docker tag [IMAGE_NAME/IMAGE_ID] [REPOSITORY_NAME]:[TAG]`
6. Push a Docker image to a repository: `docker push [REPOSITORY_NAME]:[TAG]`
7. Pull a Docker image from a repository: `docker pull [REPOSITORY_NAME]:[TAG]`

#### Networking

1. List Docker networks: `docker network ls`
2. Create a Docker network: `docker network create [NETWORK_NAME]`
3. Connect a container to a network: `docker network connect [NETWORK_NAME] [CONTAINER_NAME/CONTAINER_ID]`
4. Disconnect a container from a network: `docker network disconnect [NETWORK_NAME] [CONTAINER_NAME/CONTAINER_ID]`

#### Volume Management

1. List Docker volumes: `docker volume ls`
2. Create a Docker volume: `docker volume create [VOLUME_NAME]`
3. Remove a Docker volume: `docker volume rm [VOLUME_NAME]`
4. Attach a volume to a container: `docker run -v [VOLUME_NAME]:[CONTAINER_PATH] [IMAGE_NAME]`
5. Inspect a volume: `docker volume inspect [VOLUME_NAME]`

#### Miscellaneous

1. Open a shell inside a running container: `docker exec -it [CONTAINER_NAME/CONTAINER_ID] sh`
2. View logs of a running container: `docker logs -f [CONTAINER_NAME/CONTAINER_ID]`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://tingreavinash.gitbook.io/the-tech-toolbox/notes/docker/commands.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
