multi line docker run command on windows - docker

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.

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

Related

How to run a tkinter file on Docker in Windows?

I am trying to run a GUI created using tkinter on Docker.
This is the docker run command:
docker run -u=$(id -u $USER):$(id -g $USER) -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:rw -v $(pwd)/app:/app --rm tkinter_in_docker
I am getting the error:
unknown shorthand flag: 'g' in -g
See 'docker run --help'.
What is the correct way to run to get the desired results?

podman not running container in quay setup in centos9

I am setting up quay in a vm with centos distro. This is the guide I am following: quay deploy guide
once I install Podman I am trying to run first container with below command:
I set up this env variable:
export QUAY=QUAY
and made a dir of same name in home:
mkdir QUAY
once I install Podman I am trying to run first container with below command:
$ sudo podman run -d --rm --name postgresql-quay \
-e POSTGRESQL_USER=quayuser \
-e POSTGRESQL_PASSWORD=quaypass \
-e POSTGRESQL_DATABASE=quay \
-e POSTGRESQL_ADMIN_PASSWORD=adminpass \
-p 5432:5432 \
-v $QUAY/postgres-quay:/var/lib/pgsql/data:Z \
registry.redhat.io/rhel8/postgresql-10:1
and I am getting following error:
sudo podman run -d --rm --name postgresql-quay -e POSTGRESQL_USER=quayuser -e POSTGRESQL_PASSWORD=quaypass -e POSTGRESQL_DATABASE=quay -e POSTGRESQL_ADMIN_PASSWORD=adminpass -p 5432:5432 -v QUAY/postgres-quay:/var/lib/pgsql/data:Z registry.redhat.io/rhel8/postgresql-10:1
Error: error creating named volume "QUAY/postgres-quay": error running volume create option: names must match [a-zA-Z0-9][a-zA-Z0-9_.-]*: invalid argument
The bind mount needs to be specified as an absolute path or a relative path that starts with ./ or ../.
In other words instead of
-v QUAY/postgres-quay:/var/lib/pgsql/data:Z
use
-v ./QUAY/postgres-quay:/var/lib/pgsql/data:Z
(I replaced $QUAY with its value QUAY)

Db2 with Docker: How to resolve error from bash script?

I have a syntax problem - Mac Mojave- starting a docker bash script:
docker run -h db2server \
--name db2server_fp4 \
--restart=always p 50000:50000 \
--env-file ${HOME}/db2devc.env_list \
${HOME}/db2devc:/database \
store/ibmcorp/db2_developer_c:11.1.4.4-x86_64
gives this error:
JMB:~ Juergen$ ./db2docker2.sh
Unable to find image 'p:latest' locally
docker: Error response from daemon: pull access denied for p, repository does not exist or may require 'docker login'.
See 'docker run --help'.
./db2docker2.sh: line 6: /Users/Juergen/db2devc:/database: No such file or directory
There seems to be a mistake in your docker run command. There is missing hyphen before the p and docker recognizes it as the image name.
There also seems to be a missing -v before what looks like a volume mount.
Try with the following command:
docker run -h db2server \
--name db2server_fp4 \
--restart=always -p 50000:50000 \
--env-file ${HOME}/db2devc.env_list \
-v ${HOME}/db2devc:/database \
store/ibmcorp/db2_developer_c:11.1.4.4-x86_64

docker: invalid reference format in Mac OS X

I ran the docker run command to run the jenkins image.
But this is the command that was executed in the past, but now an error occurs.
command
docker run -u root —rm -p 8080:8080 —name jenkins \ -v Users/human/jenkins:/var/jenkins_home \
-v /var/run/docker.sock:/var/run/docker.sock \ jenkins
error
docker: invalid reference format.
See 'docker run --help'.
My environment is Mac OS X. What's wrong with me?
It could be the path "Users/human/jenkins" is invalid. If you are using $PWD following the example on Jenkins site, be very careful about possible space character in the "current" path. That would mess up the command and throw out that error message you posted.
It seems like you have a parsing issue for the command above, I have changed this — to --.. this should work:
docker run -u root --rm -p 8080:8080 --name jenkins -v Users/human/jenkins:/var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock jenkins
Or like this:
docker run -u root --rm -p 8080:8080 --name jenkins \
-v Users/human/jenkins:/var/jenkins_home \
-v /var/run/docker.sock:/var/run/docker.sock \
jenkins

Docker & Zalenium: Unable to start due to invalid reference format error

Really new to docker and docker infrastructure. So from the official Zalenium github page I followed all the steps successfully until I get to the point:
docker run --rm -ti --name zalenium -p 4444:4444 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /tmp/videos:/home/seluser/videos \
--privileged dosel/zalenium start
and after executing it I'm getting:
> docker: invalid reference format.
> See 'docker run --help'
While doing research here on SOF, I've landed here and here, but nothing seems to work in my situation. I've tried to replace --rm -ti to the end of the expression: didn't work
docker run --name zalenium -p 4444:4444 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /tmp/videos:/home/seluser/videos \
--privileged --rm -ti dosel/zalenium start
I'm sure there is a specific format that I have to follow, but can't find a clue to it (missing comma, wrong backslash, unnecessary whitespace). Appreciate for your help.
I just noticed that the command example we have does not work for Windows, I just changed the docs to show how to run a multiline command in Windows.
Here is the way:
docker run --rm -ti --name zalenium -p 4444:4444 ^
-v /var/run/docker.sock:/var/run/docker.sock ^
-v /c/Users/your_user_name/temp/videos:/home/seluser/videos ^
--privileged dosel/zalenium start

Resources