# Dockerfile

## Imagen como una clase donde un contenedor es una instancia de la misma

### Ejemplo practico

* Generar archivo [Dockerfile](https://github.com/zeroidentidad/docker-facilito/tree/9aeb3023ae1d4c93c9791a1b59ba9af2adce127a/images/Dockerfile/README.md)

```
# crear Dockerfile a editar
nano Dockerfile
# contenido de ejemplo, sobre estructura directivas
FROM ubuntu

RUN mkdir app
RUN cd /app && touch data.txt
# ubicarse donde fue creado archivo y construir imagen usando el Dockerfile
# uso flag -t para nombre (tag image) y con . detectar Dockerfile en la ruta actual
docker image build -t ubuntu-file2 .
# salida
Sending build context to Docker daemon  68.61kB
Step 1/3 : FROM ubuntu
 ---> 72300a873c2c
Step 2/3 : RUN mkdir app
 ---> Running in d8788cec57b7
Removing intermediate container d8788cec57b7
 ---> e6755560ff34
Step 3/3 : RUN cd /app && touch data.txt
 ---> Running in a7e9c74ded95
Removing intermediate container a7e9c74ded95
 ---> ff1c74b8cdce
Successfully built ff1c74b8cdce
Successfully tagged ubuntu-file2:latest
```

* Verificar resultado uso Dockerfile

```
# listar imagenes existentes y ver si esta la personalizada
docker image ls
# salida
REPOSITORY          TAG                 IMAGE ID            CREATED              SIZE
ubuntu-file2        latest              ff1c74b8cdce        About a minute ago   64.2MB
# probar creando contenedor con la nueva imagen
docker container run -it ubuntu-file2
# ver resultado operaciones creacion
ls
cd app && ls
```


---

# 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://zeroidentidad.gitbook.io/docker-facilito/images/dockerfile.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.
