0

I am trying to run the following command within a script and keep getting the following error

docker: invalid reference format.

I also tried running the cmd without quotes around the env variable names and also without $ and { , same result.

sudo docker run --name "${container_name}-${number}" --cpus="${cpus_per_container}" \
--cpuset-cpus="${cpu_1}","${cpu_2}" \
--restart always -e VIRTUAL_HOST="${virtual_host}" \
-e NODE_ENV="${environment}" -d "${container_registry}:${tag_name}"

Anything that should be changed in the above?

elixir
  • 173
  • 2
  • 13
  • Does this answer your question? [docker : invalid reference format](https://stackoverflow.com/questions/45682010/docker-invalid-reference-format) – Perplexabot May 06 '21 at 14:48
  • Probably better to add `$USER` to docker group vs running with `sudo`. – Perplexabot May 06 '21 at 14:49
  • 3
    Are all of those shell variables set? Put the word `echo` at the front of the command and run it; what's the command line it prints out? – David Maze May 06 '21 at 15:01
  • (Since it's pretty trivial to use `docker run` to root the host, it's appropriate to require `sudo` access for it.) – David Maze May 06 '21 at 15:01
  • @DavidMaze - docker should never be used in production because of the risk you mention, however, docker is a dev tool and it's much better to put the developer in the docker group on their local machines for their convenience. – Software Engineer May 07 '21 at 08:45
  • yup was an env variables that wasn't getting transferred correctly from another place, that got it working, also switched to docker run by adding $USER to the group, thanks! – elixir May 07 '21 at 14:24

0 Answers0