Copying Container Files

Copying Container Files

Copying Container Files

Motivation

  • Copying files from Containers in a cluster to a local filesystem
  • Copying files from a local filesystem to Containers in a cluster

Local to Remote

Copy a local file to a remote Pod in a cluster.

  • Local file format is <path>
  • Remote file format is <pod-name>:<path>
kubectl cp /tmp/foo_dir <some-pod>:/tmp/bar_dir

Remote to Local

Copy a remote file from a Pod to a local file.

  • Local file format is <path>
  • Remote file format is <pod-name>:<path>
kubectl cp <some-pod>:/tmp/foo /tmp/bar

Last modified February 18, 2023: Fix some small doc typos (31e6c04)