> For the complete documentation index, see [llms.txt](https://did-web.gitbook.io/notas-docker/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://did-web.gitbook.io/notas-docker/docker-compose/volumenes-en-docker-compose.md).

# 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.
