Skip to content

Instantly share code, notes, and snippets.

@philipz
Created October 17, 2023 10:22
Show Gist options
  • Save philipz/606ed879520eeeb92c58583568191971 to your computer and use it in GitHub Desktop.
Save philipz/606ed879520eeeb92c58583568191971 to your computer and use it in GitHub Desktop.
kubectl cp command terminates with exit code 126?

copy a file from local filesystem into a container:

cat [local file path] | kubectl exec -i -n [namespace] [pod] -c [container] "--" sh -c "cat > [remote file path]"

ex:

cat keycloak-benchmark-dataset-0.10-SNAPSHOT.jar | k exec -i pods/keycloak-65f866dc7b-2kpn5 "--" sh -c "cat > /opt/keycloak/providers/keycloak-benchmark-dataset-0.10-SNAPSHOT.jar"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment