File Transfer - mensfeld/code-on-incus GitHub Wiki

Transfer files and directories between host and containers.

Push Files to Container

Copy files from your host into a container:

# Push single file
coi file push ./config.json my-container:/workspace/config.json

# Push directory (recursive)
coi file push -r ./src my-container:/workspace/src

# Push with custom permissions
coi file push ./script.sh my-container:/usr/local/bin/script.sh

Pull Files from Container

Copy files from a container to your host:

# Pull single file
coi file pull my-container:/workspace/build.log ./build.log

# Pull directory (recursive)
coi file pull -r my-container:/home/code/.claude ./saved-sessions/session-123/

# Pull build artifacts
coi file pull -r my-container:/workspace/dist ./output/

Common Use Cases

Backup Session Data

# Save AI tool session to host
coi file pull -r my-container:/home/code/.claude ./backups/session-$(date +%Y%m%d)/

Inject Configuration

# Push config files before starting session
coi file push ./custom-config.toml my-container:/home/code/.config/tool/config.toml

Extract Build Artifacts

# Copy compiled binaries or build output
coi file pull -r my-container:/workspace/build ./artifacts/

Share Files Between Containers

# Pull from one container, push to another
coi file pull my-container-1:/workspace/data.json ./temp.json
coi file push ./temp.json my-container-2:/workspace/data.json

Notes

  • File ownership is preserved when possible
  • Use -r flag for recursive directory operations
  • Paths in containers must be absolute
  • Works with both running and stopped containers