Files
fn_registry/bash/functions/infra/docker_cp_file.md
T
egutierrez fc4180cbb3 chore: auto-commit (129 archivos)
- .claude/agents/fn-analizador/SKILL.md
- .claude/agents/fn-constructor/SKILL.md
- .claude/agents/fn-executor/SKILL.md
- .claude/agents/fn-mejorador/SKILL.md
- .claude/agents/fn-orquestador/SKILL.md
- .claude/agents/fn-recopilador/SKILL.md
- .claude/commands/app.md
- .claude/commands/compile.md
- .claude/commands/cpp-app.md
- .claude/commands/create_functions.md
- ...

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-01 22:23:12 +02:00

1.6 KiB

name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, params, output, 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 params output 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
name desc
local_path ruta del archivo local a copiar
name desc
container_name nombre del contenedor Docker destino
name desc
dest_path ruta destino dentro del contenedor
JSON con local_size y remote_size en bytes false
bash/functions/infra/docker_cp_file.sh

Ejemplo

source functions/infra/docker_cp_file.sh

result=$(docker_cp_file $HOME/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.