# Docker Run

### When executing the docker run command

* You can run a container from a locally stored Docker image
  * If the image does not exist on the system, it is pulled from an online registry

### image pull

* When an image is pulled, the `layers` are stored independently
* When running a container, these layers are `stacked` in order and `mounted` at a specific location
* By default, the layers belonging to the image are `read-only` and never change
* On top of them, a final `container-specific writable layer` is added, and all `changes` that occur in the container are saved to this layer

### Running a container

* When running a container, a clean layer is placed on top of the image's topmost layer
* No matter how many containers are running, they do not affect each other because the layer where actual `writes` occur is `separated`
  * In other words, every container has its own `unique writable area`, which becomes the topmost layer and does not affect any of the lower layers


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://chloe-codes1.gitbook.io/til/docker/03_docker_run.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
