"Absent expression after unary operator '-'" when trying to install postgres by Docker

Asked

Viewed 280 times

0

code:

docker run \
--name postgres \
-e POSTGRES_USER=spirit \
-e POSTGRES_DB=spiritSt \
-e 5432:5432 \
-d \
postgres

was following a tutorial and it worked normal but on my pc I have this error:

No linha:2 caractere:3
+ --name postgres \
+   ~
Expressão ausente após operador unário '--'.
No linha:2 caractere:3
+ --name postgres \
+   ~~~~
Token 'name' inesperado na expressão ou instrução.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingExpressionAfterOperator

1 answer

1

The \ to use multiple lines does not work in powershell, exchange it for "severe accent", something like this:

docker run `
--name postgres `
-e POSTGRES_USER=spirit `
-e POSTGRES_DB=spiritSt `
-e 5432:5432 `
-d `
postgres

And after that just type enter twice.

Powershell 5+

If you are using Powershell 5 or above and want to manually type the command and its instructions then you can use Shift+Enter each new row you wish to insert

Read more on: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_line_editing?view=powershell-6

Browser other questions tagged

You are not signed in. Login or sign up in order to post.