romantasi
(Romantasi)
December 31, 2021, 8:40am
1
After running this command:
docker run -d --name elastalert --restart=always -v $(pwd)/elastalert.yaml:/opt/elastalert/config.yaml -v $(pwd)/elastalert_rules:/opt/elastalert/rules ghcr.io/jertel/elastalert2/elastalert2 --verbose -v $(pwd)/smtp_auth_user.yaml:/opt/elastalert/smtp_auth_user.yaml
I am getting this error in the docker logs
:
elastalert: error: unrecognized arguments: -v /etc/elastalert/smtp_auth_user.yaml:/opt/elastalert/smtp_auth_user.yaml
The command was working fine before I added the
-v $(pwd)/smtp_auth_user.yaml:/opt/elastalert/smtp_auth_user.yaml
to my docker run
command. Can anyone help?
meyay
(Metin Y.)
December 31, 2021, 9:14am
2
Every argument after the image name is treated as argument for the entrypoint script (or in the absence of an entrypoint script as command).
Thus said, these arguments are processed inside the container:
But $(pwd)
will be interpolated on the host. Are you sure the current host path is correct from inside the container as well?
romantasi
(Romantasi)
December 31, 2021, 9:28am
3
I am certain the current host path is correct. For example, the elastalert.yaml
is in the same location as the smtp_auth_user.yaml
but is not giving an error.
Also moving the --verbose
argument does not fix the issue.
meyay
(Metin Y.)
December 31, 2021, 9:47am
4
Is --verbose
or -v ...
even a valid parameter for the image ghcr.io/jertel/elastalert2/elastalert2?!
The -v
parameter at the end looks like a docker parameter and Is more likely supposed to be used as container parameter? If so, then it needs to be before the image name.
rimelek
(Ákos Takács)
December 31, 2021, 10:06am
5
Because that is a volume mount and as @meyay wrote
So you must use this volume mount before the image name exactly as you did with the other volume mounts:
-v $(pwd)/elastalert.yaml:/opt/elastalert/config.yaml -v $(pwd)/elastalert_rules:/opt/elastalert/rules
There was nothing wrong with that argument probably. I recommend using a different syntax for your long commands to understand it more:
docker run -d --name elastalert --restart=always \
-v $(pwd)/elastalert.yaml:/opt/elastalert/config.yaml \
-v $(pwd)/elastalert_rules:/opt/elastalert/rules \
-v $(pwd)/smtp_auth_user.yaml:/opt/elastalert/smtp_auth_user.yaml \
ghcr.io/jertel/elastalert2/elastalert2 --verbose
Now you can see where the volume mounts are and where the container commands start
The above syntax is for Linux and MacOS.
1 Like