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 .).
Related
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
docker run -it -v C:\Users\HP\Documents\Deep Learning\potato_project:/potato_project -p 8605:8605 --entrypoint /bin/bash tensorflow/serving
It is showing docker:invalid reference format.
enter image description here
Try your path into quotes:
docker run -it -v "C:\Users\HP\Documents\Deep Learning\potato_project:/potato_project" -p 8605:8605 --entrypoint /bin/bash tensorflow/serving
Its seems its due to the space in the path name
I am trying to run a software for predicting hemorrhage volume on brain CT in docker: https://github.com/msharrock/deepbleed
I created a "deepbleed" folder in my D:\ drive on windows, and ran docker pull msharrock/deepbleed command after I cd'd inside that directory. The pull was successful and I can see the container in my docker desktop app.
Then I went on and created an indir and outdir folder as instructed in documentation; placed my CT file for prediction in the indir folder.
The readme tells me to run this command next:
docker run -it msharrock/deepbleed bash -v /path/to/data:/data/
So I have run the following commands, but I get "no such file or directory" for all of them:
docker run --rm -it msharrock/deepbleed bash -v pwd/deepbleed/indir:outdir
docker run --rm -it msharrock/deepbleed bash -v ~/deepbleed/indir:/outdir/
docker run --rm -it msharrock/deepbleed bash -v /mnt/d/deepbleed/indir:/outdir/
docker run --rm -it msharrock/deepbleed bash -v /d/deepbleed/indir:/outdir
docker run --rm -it msharrock/deepbleed bash -v "$(& "D:\deepbleed\indir" "$(pwd)")":/outdir
docker run --rm -it msharrock/deepbleed bash -v /indir/:/outdir/
docker run --rm -it msharrock/deepbleed bash -v //d:/deepbleed/indir://d:/deepbleed/outdir/
docker run --rm -it msharrock/deepbleed bash -v //d/deepbleed/indir://d/deepbleed/outdir/
docker run --rm -it msharrock/deepbleed bash -v //d/deepbleed/indir:/outdir/
My docker is running on a wsl2 based engine in windows 10, the hyper-v folders for disks and virtual machines are located on my d: drive.
What do I need to do to get this running?
Try doing it like this (just using one of your items in the list for this example to give you the idea):
docker run -rm -it -v /mnt/d/deepbleed/indir:/outdir msharrock/deepbleed bash
I am still not well versed with docker so apologies in advance.
I need to run this package: https://github.com/sclevine/yj
What I have done so far is
pulled this image in my GOPATH (i don't think it was needed to be on GOPATH though).
Then i did docker build yj .
Now, I don't know how to execute the command to convert github yaml to hcl. I have tried following commands but all gave "help" message from the program
docker run -it <image_id> /bin/bash
docker run -it <image_id> /bin/yj
docker run -it <image_id>
docker run -it <image_id> -yc
docker run -it <image_id> /bin/yh -yc
docker run -it <image_id> /bin/yh
docker run -it --entrypoint /bin/bash ad5d67b05c22
docker run -it <image_id> -xyc
docker run -it <image_id> yj -yc
Few commands like docker run -it <image_id> yj -yc, didn't show any error. the cursoer stayed in console (without any prompt). I tried pasting my yaml file but nothing happened.
There are a few things to clarify here:
Your build command has syntax error and it should be something like docker build -t yj . which will build a new image with name yj and tag latest
Whenever you run docker run -it <image_id> /bin/bash it will create a new container and you will have to explicitly remove it. You can see all those containers using docker ps -a. For one-off usage, please add a flag --rm so that docker will remove the container whenever the container exits.
Once the image yj has been built, here are some of the commands that you can run to see how it works
docker run --rm -i yj <<EOF
key: value
EOF
or
echo key: value | docker run --rm -i yj
Trying to write an npm script for my project. I am using docker and i was trying simplify the application start commands. I don't want to use the docker compose command at this time.
I am trying to run the below command in npm script.
"scripts": {
"app-start" : "docker system prune && docker run -p 3000:3000 -v
/app/node_modules -v $(pwd):/app $(docker build -f Dockerfile.dev
.)"
}
is there a way to provide parameter to docker run command using docker build, something like below:
docker run -p 3000:3000 -v
/app/node_modules -v $(pwd):/app $(docker build -f Dockerfile.dev
.)
Also any improvements/ suggestions on the above commands
Use the -q / --quiet switch
Suppress the build output and print image ID on success
So your command will end with
docker run -p 3000:3000 -v /app/node_modules -v $(pwd):/app $(docker build -q -f Dockerfile.dev .)