Weird behavior of calling docker run from bash script

Hi All,
I try to run docker run from bash script and docker says:
“is not a docker command”
If I print the docker command line before I called docker and copy to clipboard and paste it to command line it works well!
here is the command in bash script:

local args=“run ${nw_param} ${opts} --name ${img} ${repository}/${img}:${tag}”
docker ${args}

the current echo of args string is:

run --net=ehvb-network -d --restart=always --name my-module my-private-registry:5000/my-module:0.0.1-1555334810

When I copied this string to the clipboard and paste it to command line it works well.
I use Debian stretch. My script is using bash (#!/bin/bash)
What should be the problem?
thx
Zamek

A new result, when I remove ${opts} it runs from bash. Opts currently contains “-d --restart=always” . When I try to use only -d or only --restart=always it works well. But when I try to use both together it doesn’t work well.
And I try to define opts like this:
opts=’–restart=always -d’
the message from docker is:
docker: Error response from daemon: invalid restart policy ‘always -d’, but the print message contains:
opts:–restart=always -d

Somebody removes --restart=

thx
Zamek

I found the problem: bash variables coming from bash command line contain a carriage return char. Simple need to add a | sed 's/\r//" to the commands