"docker run" requires at least 1 argument - docker

I'm trying to run this Docker command related to GoPhish
$ docker run -d --restart always -p 8080:8080 -p 8443:8443 --name web_server -v ${HOME}/Docker/Gophish/apache:/opt/bitnami/apache2/htdocs/bitnami/apache:latest
I also tried to use docker container run but it's not working.
but it's showing this issue :
"docker run" requires at least 1 argument.
See 'docker run --help'.
Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
Run a command in a new container

Related

Unable to run docker build inside docker run

I am trying to build an image and then run it in one command. Using stackoverflow question I have menaged to scrape this command:
docker run --rm -it -p 8000:8000 -v "%cd%":/docs $(docker build -q .)
However it produces an error:
docker: invalid reference format.
See 'docker run --help'.
First part of the command ( docker run --rm -it -p 8000:8000 -v "%cd%":/docs .) works properly on already built image the problem lies inside $(docker build -q .). Dockerfile is inside the folder I have opened in cmd.
You need to run it in PowerShell, not cmd.
Try docker run --rm -it -p 8000:8000 -v ${PWD}:/docs $(docker build -q .).

How to start a docker container from a image with a given name?

I am trying to run an image with a given container name.
How to achieve this?
I am running this command:
docker run -it -d macgyvertechnology/tensorflow-gpu:basic-jupyter --name hugging-face-models-run --gpus all
Docker run command format:
$ docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
You need to update your command to
$ docker run -it -d --name hugging-face-models-run --gpus all macgyvertechnology/tensorflow-gpu:basic-jupyter
Reference:
https://docs.docker.com/engine/reference/commandline/run/#usage

Error message when creating docker container

I'm trying to create a new docker container using the following command:
docker run -d -it --name compsci -v /c/Users/garre/Documents/CPSC_Courses:/homechapmanfse/computing-resources:cs_base
However, it gives me this error message:
"docker run" requires at least 1 argument.
See 'docker run --help'.
Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
Run a command in a new container
How would I fix this?
You have to provide the name of the image that you want to run. This is currently missing in your command.
For example, if I were to run mysql, I would execute this:
docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql
See the last argument, mysql? That is the name of the image.
Think that you it has build image in your machine. You must inform name of image run.
docker run image-name
This command --name is necessary only you specific name for your container. And the -it command must be entered only when entering the executed container.
docker run -d -it -v
/c/Users/garre/Documents/CPSC_Courses:/homechapmanfse/computing-resources:cs_base
--name 'the name you want to give' 'official name of the image'

Docker run not working it says requires at least 1 argument

I'm learning docker, and trying to run the existing images. The first command is working fine
command 1: docker run --name static-site -e AUTHOR="Mathi1" -d -P dockersamples/static-site
But the below command is throwing error
Command 2: docker run --name mvcdotnet -e AUTHOR="Mathi2" -d -p valkyrion/mvcdotnet
Error:
"docker run" requires at least 1 argument.
See 'docker run --help'.
Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
Run a command in a new container
According to docker help run:
…
-p, --publish list Publish a container's port(s) to the host
-P, --publish-all Publish all exposed ports to random ports
…
Command 1 uses -P (short form of --publish-all) and after that the image name. -P has no arguments.
Command 2 uses -p (short form of --publish list). -p expects an argument and I think docker mistakes the image name as the argument for -p (and expects an image name after that).

Sonarqube doesn't work on Docker

I'm running a docker container; it's sonarqube: When I use this command:
docker run -d --restart=always --name sonarqube -p 9000:9000 -p 9092:9092 sonarqube
The container runs well, but when I use the command to run and to configure the database, this command:
docker run -d --restart=always --name sonarqube -p 9000:9000 -p 9092:9092 -e SONARQUBE_JDBC_USERNAME=my_user_name -e SONARQUBE_JDBC_PASSWORD=my_password -e SONARQUBE_JDBC_URL=jdbc:postgres://host:123qweasdzxc#ec2-54-243-28-109.compute-1.amazonaws.com:5432/database?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory sonarqube
I'm getting this error:
"docker run" requires at least 1 argument.
See 'docker run --help'.
Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...] [flags]
Run a command in a new container
What is wrong? or How to fix this little problem?
Use single quotes in your "SONARQUBE_JDBC_URL" environment variable. I just tried to delimit that particular variable so that docker understands it as a complete string with it's starting & ending point. Due to some reason, it was unable to fetch the IMAGE_NAME argument which was required to run the container.
docker run -d --restart=always --name sonarqube -p 9000:9000 -p 9092:9092 -e SONARQUBE_JDBC_USERNAME=my_user_name -e SONARQUBE_JDBC_PASSWORD=my_password -e SONARQUBE_JDBC_URL='jdbc:postgres://host:123qweasdzxc#ec2-54-243-28-109.compute-1.amazonaws.com:5432/database?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory' sonarqube
This worked for me.
The sonarqube docker image latest version did not work for me either, However below image worked for me. If you using docker for learning purpose you can follow below steps. Please note, By default, the image will use an embedded H2 database that is not suited for production.
Run below command to pull the docker image:
docker pull sonarqube:lts-community
Run below command to create the docker container for sonarqube:
-h, --hostname string Container host name
-d, --detach Run container in background and print container ID
docker run --name sanarqube -h sonarqube -p 8084:9000 -d sonarqube
search sonarqube UI in your favourite browser
http://YOUR-IP:8084/
Then to stop the conatiner
docker stop sonarqube
Then to start the conatiner
docker start sonarqube
Hope this help!

Resources