# Volúmenes en docker-compose

## Creación de volúmen

```
version: '3'
services:
  web:
    container_name: nginx1
    ports: 
      - "8001:80"
    volumes:
      - "vol2:/usr/share/nginx/html"
    image: nginx
volumes:
  vol2:
```

## Creación de volúmen tipo host

```
version: '3'
services:
  web:
    container_name: nginx2
    ports: 
      - "8002:80"
    volumes:
      - "/var/www/html/mi_web_test:/usr/share/nginx/html"
    image: nginx
```

Donde `/var/www/html/mi_web_test` estaría mi página web html

Si eliminamos el container los datos persisten en `/var/www/html/mi_web_test` ya que `nginx` copia el contenido en su raíz del servidor html.


---

# 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://did-web.gitbook.io/notas-docker/docker-compose/volumenes-en-docker-compose.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.
