Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

multi-line command line in bash fails while equal one line command line succeeds

I try to figure out why the following command fails

docker run \
  --rm \
  --name somedb \
  -v "$(pwd)/database:/var/lib/mysql/" \
  -p "3306:3306" \
  -e MARIADB_USER=dbuser \ 
  -e MARIADB_PASSWORD=dbuserpwd \
  -e MARIADB_ROOT_PASSWORD=rootpwd \
  -d \
  mariadb:10.10-jammy

with the message:

docker: invalid reference format.
See 'docker run --help'.
-e : commande introuvable    ## command could not be found in french

while the equivalent one line command line

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

docker run --rm --name somedb -v "$(pwd)/database:/var/lib/mysql/" -p "3306:3306" -e MARIADB_USER=dbuser -e MARIADB_PASSWORD=dbuserpwd -e MARIADB_ROOT_PASSWORD=rootpwd -d mariadb:10.10-jammy

succeeds.

>Solution :

There’s a space after your -e MARIADB_USER=dbuser \

enter image description here

This worked

docker run \
  --rm \
  --name somedb \
  -v "$(pwd)/database:/var/lib/mysql/" \
  -p "3306:3306" \
  -e MARIADB_USER=dbuser \
  -e MARIADB_PASSWORD=dbuserpwd \
  -e MARIADB_ROOT_PASSWORD=rootpwd \
  -d \
  mariadb:10.10-jammy
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading