Files
fn_registry/bash/functions/infra/docker_cp_file.md
T
egutierrez 54be36dd63 docs: CLAUDE.md actualizado con fn run, tipos Go en functions/, bash functions
Documentación de fn run para todos los lenguajes, nueva ubicación de tipos Go,
sección de uso por agentes. Añadidas funciones Bash del registry (shell, infra,
core, pipelines).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 23:23:30 +01:00

1.3 KiB

name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, tested, tests, test_file_path, file_path
name kind lang domain version purity signature description tags uses_functions uses_types returns returns_optional error_type imports tested tests test_file_path file_path
docker_cp_file function bash infra 1.0.0 impure docker_cp_file(local_path: string, container_name: string, dest_path: string) -> string Copia un archivo local a un contenedor Docker y verifica que el tamaño coincide. Imprime JSON con local_size y remote_size a stdout. Sale con exit code 1 si docker cp falla o los tamaños difieren.
docker
cp
copy
file
container
transfer
infra
bash
false error_go_core
false
bash/functions/infra/docker_cp_file.sh

Ejemplo

source functions/infra/docker_cp_file.sh

result=$(docker_cp_file /home/lucas/fn_registry/registry.db metabase /registry.db)
echo "$result"
# {"local_size":524288,"remote_size":524288}

local_size=$(echo "$result" | grep -o '"local_size":[0-9]*' | cut -d: -f2)

Notas

La verificación de tamaño usa docker exec stat -c%s sobre el contenedor destino. Si stat no está disponible en el contenedor, remote_size será -1 y la función fallará.

Output a stdout: JSON minificado con campos local_size y remote_size (enteros, bytes).

Usa printf en lugar de echo para garantizar que no haya newline extra en el JSON.