I have this docker run command:
docker run --rm --name=gitleaks \
-v "/keys/ssh/values:/root/.ssh" \
zricethezav/gitleaks \
--ssh-key='bucket' \
--repo "$line"
I tranlated it to this:
docker create zricethezav/gitleaks --name=gitleaks
docker cp /keys/ssh/values gitleaks:/root/.ssh
docker start gitleaks --ssh-key='bucket' --repo "$line"
but it gives me this error:
Error: No such container:path: gitleaks:/root unknown flag: --ssh-key
Does anybody know where I went wrong? Ultimately I am calling docker run from within a running container and am having trouble sharing files, so trying to get docker cp
to work.
You need to use the docker container ID not its name for the copy.
The ID is returned when creating the container,so:
If you've already created the container, you can:
But, @mihai is correct and I'm unsure how you'd be able to then configure the container for the start.
I think the correct approach to this is toFROM:gitleaks
and build your own image (Dockerfile) that adds your keys.The documentation provides an explanation for using a GitHub token to access private repos:
https://github.com/zricethezav/gitleaks#docker-usage-examples