Issue is with your first and second command syntax.
docker create zricethezav/gitleaks --name=gitleaks
--name
should be before image name, otherwise docker create
will interpret it as COMMAND argument instead of OPTIONS flag.
docker start gitleaks --ssh-key='bucket' --repo "$line"
I understand you want to run the image with parameters --ssh-key and --repo, however it's not possible with docker start
command. If you want to have these parameters passed to the process run by the image, you should pas these parameters to docker create
or docker run
command after the image name.
So you should do:
# Mind the --name before the image name
docker create --name=gitleaks zricethezav/gitleaks --ssh-key='bucket' --repo "$line"
docker cp /keys/ssh/values gitleaks:/root/.ssh
docker start gitleaks
Explanations for docker create:
docker create
usage is:
docker create [OPTIONS] IMAGE [COMMAND] [ARG...]
Where OPTIONS
flags should be specified before IMAGE
, and everything after IMAGE
will be interpreted as COMMAND
and ARG...
.
When you are running
docker create zricethezav/gitleaks --name=gitleaks
You are in fact passing --name=gitleaks
as COMMAND
which will override default image command (the one tipycally provided by CMD
in Dockerfile), where you probably want to pass it as OPTIONS
. For example, if you run:
docker create alpine --name=foobar
docker create --name=foobar alpine
docker ps -a
output will look like:
IMAGE COMMAND NAMES
alpine "/bin/sh" foobar
alpine "--name=foobar" quirky_varahamihira
If you want to pass both OPTIONS
and COMMAND
, you must specify OPTIONS
before the image name and COMMAND
after the image name.
--rm
flag from docker run to the 3 subcommands, not sure where to put that – Kempis