Secrets working from UI, not command line

When I create a secret in the UI, it work fine -

/ # cat /run/secrets/JENKINS_PASSWORD
jenkinspassword/ #

When I use the command line as per the docs:

echo “jenkinspassword” | docker secret create JENKINS_PASSWORD -

It looks like there is a newline added:

/ # cat /run/secrets/JENKINS_PASSWORD
/ #

And this difference kills my jenkins pipeline script when I use the secret to login to my local DTR

docker --version
Docker version 17.03.1-ee-3, build 3fcee33

Universal Control Plane 2.1.4 (10e6c44) API: 1.27

OK I guess I need to use “echo -n” to omit the newline

Maybe the docs could be changed to reflect this