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

# Docker

{% hint style="warning" %}
**Crear un archivo:** Debemos crear un archivo docker-compose.yml
{% endhint %}

```yaml
// Some code
version: '3.3'

services:
    postgres:
        image: postgres:13
        environment:
          - POSTGRES_DB=my_store
          - POSTGRES_USER=gelvezz23
          - POSTGRES_PASSWORD=carlos123
        ports:
          - 5432:5432
```

## Comandos

### levantar el servicio

```
docker compose up -d postgres
```

**up** : para levantar docker

**-d** : correr en segundo plano&#x20;

**postgres**: nombre de nuestro servicio en el archivo .yml

### ver los servicios corriendo

```
docker compose ps
```

**ps** : ver los procesos que estan corriendo en segundo plano

### bajar los servicios corriendo

```
docker compose down
```

down : bajar los servicios que estan corriendo&#x20;

### crear volumenes para persistir estados de informacion

```yaml
version: '3.3'

services:
    postgres:
        image: postgres:13
        environment:
          - POSTGRES_DB=my_store
          - POSTGRES_USER=gelvezz23
          - POSTGRES_PASSWORD=carlos123
        ports:
          - 5432:5432
        volumes:
          - ./postgres_data:/var/lib/postgres/dataym
```

creamos la linea de volumenes en el `archivo .yml` y creamos una carpeta llamada `postgres_data`

### explorar el servicio corrido en Docker

```
docker compose exec postgres bash
```

conectar se desde la terminal&#x20;

### entrar a la base de datos de Postgres

```
psql -h localhost -d my_store -U gelvezz23
```

**my\_store**: es el nombre que le colocamos en el archivo `.yml POSTGRES_DB=my_store`

**gelvezz23**: es el usuario que lo colocamos en el archivo `.yml` `POSTGRES_USER=gelvezz23`

### salir de la BD

```
\q
```

### salir del contenedor

```
exit
```


---

# 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 dynamically by asking a question.

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

```
GET https://gelvezz23.gitbook.io/my-blog/learning/docker.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.
