0

I have a bash script that composes a docker run command chaining different volumes with -v:

VOL_ONE="-v $PWD/path/one:/home/docker/app/path/one"
VOL_TWO="-v $PWD/path/two:/home/docker/app/path/two"
RUN_VOLUMES="$VOL_ONE $VOL_TWO"

docker run --rm -it $RUN_VOLUMES docker.myserver.io/path/to/image:latest command

It runs absolutely fine when I use bash to run it.

However when I run the exact same script using zsh instead of bash I get:

docker: Error response from daemon: invalid volume specification

I've tried both on Ubuntu and macOS, getting the exact same problem.

Francesco Borzi
  • 56,083
  • 47
  • 179
  • 252
  • Could it be this issue: http://zsh.sourceforge.net/FAQ/zshfaq03.html#l18 ? –  Aug 08 '19 at 14:54

1 Answers1

0

Does this work:

VOL_ONE=(-v $PWD/path/one:/home/docker/app/path/one)
VOL_TWO=(-v $PWD/path/two:/home/docker/app/path/two)
RUN_VOLUMES=(${VOL_ONE[*]} ${VOL_TWO[*]})

echo docker run --rm -it ${RUN_VOLUMES[*]} docker.myserver.io/path/to/image:latest command

If it prints the desired result, remove the echo.