4

I want to run multi line docker run command on windows.

say,

docker run --name packer \
-d ekambaram/packer:1.4.0

getting the below error

C:\Users\ekambaram_pasham>docker run --name packer \
docker: invalid reference format.
See 'docker run --help'.

C:\Users\ekambaram_pasham>-d ekambaram/packer:1.4.0
'-d' is not recognized as an internal or external command,
operable program or batch file.
P Ekambaram
  • 9,536
  • 3
  • 21
  • 46
  • 2
    Possible duplicate of [Windows: How to specify multiline command on command prompt?](https://stackoverflow.com/questions/605686/windows-how-to-specify-multiline-command-on-command-prompt) – leopal Apr 25 '19 at 10:53

1 Answers1

11

In the command prompt on windows I was able to run multi line docker run commands as shown below

docker run --name packer ^
-d ekambaram/packer:1.4.0

use ^ as command separator instead of \

C:\Users\ekambaram_pasham>docker run --name packer ^
More? -d ekambaram/packer:1.4.0
7e3599a599a7b19613f50323456d66a324c2ac558bb71eb9060bda54dfcd8f4d

For PowerShell, you will need to substitute with ` (back tick) instead of ^ or \ as below

docker run -p 80:80 -p 443:443 `
           -h hostname.domain `
           -e "MYSQL_ROOT_PASSWORD=password" `
           -e "SOGO_WORKERS=1" `
           -e "POSTMASTER_PASSWORD=(plain)password" `
           -e "IREDAPD_PLUGINS=['reject_null_sender', 'reject_sender_login_mismatch', 'greylisting', 'throttle', 'amavisd_wblist', 'sql_alias_access_policy']" `
           -v iredmail_mysql:/var/lib/mysql `
           -v iredmail_vmail:/var/vmail `
           -v iredmail_clamav:/var/lib/clamav `
           --name=iredmail lejmr/iredmail:mysql-latest
duct_tape_coder
  • 322
  • 2
  • 17
P Ekambaram
  • 9,536
  • 3
  • 21
  • 46
  • 1
    For Powershell, additionally to what said correctly, the ` backtick must be the very last character in the line. Even a single space AFTER will end the command and produce an error on the very next line. – Joerg Krause Apr 03 '20 at 12:53