Docker cant find file location in windows 10 - docker

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

Related

make: *** No rule to make target 'build-x86_64'. Stop

I am following a tutorial series on yt https://www.youtube.com/watch?v=FkrpUaGThTQ
how to make an os soo
when in **Build for x86 ** use the command make build-x86_64 then it shows this error `
make: *** No rule to make target 'build-x86_64'. Stop.
`
I dont know how to fix it
Per the original YouTube author of the tutorial, this is the fix :
Try one of the following commands when entering the docker container from your host OS
For Linux, MacOS, WSL, etc :
docker run --rm -it -v "$pwd":/root/env myos-buildenv
docker run --rm -it -v "$PWD":/root/env myos-buildenv
docker run --rm -it -v "$(pwd)":/root/env myos-buildenv
Windows Powershell :
docker run --rm -it -v "${pwd}:/root/env" myos-buildenv
Windows CMD :
docker run --rm -it -v "%cd%":/root/env myos-buildenv
You just need to go back one directory by typing
"cd .."
then enter another command
"cd env" to move into the env folder
then you can enter "make build x86_64" command
Make the "MakeFile" file name as "makefile" and run the command "make build-x86_64"
Same problem I had. Just go on with Carey S.Turner`s answer.
Windows Powershell: docker run --rm -it -v "${pwd}:/root/env" myos-buildenv
Windows CMD: docker run --rm -it -v "%cd%":/root/env myos-buildenv
I had error with cmd but powershell worked fine for me.
I had the same error I found that it could be fixed by doing this bit right
Enter build environment:
Linux or MacOS: docker run --rm -it -v "$(pwd)":/root/env myos-buildenv
Windows (CMD): docker run --rm -it -v "%cd%":/root/env myos-buildenv
Windows (PowerShell): docker run --rm -it -v
"${pwd}:/root/env" myos-buildenv
Please use the linux command if you are using WSL, msys2 or git bash NOTE: If you are having trouble with an unshared drive, ensure your docker daemon has access to the drive you're development environment is in. For Docker Desktop, this is in "Settings > Shared Drives" or "Settings > Resources > File Sharing".
(https://github.com/davidcallanan/os-series/blob/ep1/README.md)
My error came out of me not doing the "$(pwd)" bit correctly

How to pass in stdin input to a go app from dockerimage

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

How can I execute command inside a Docker container from a Composer image?

I am using docker run --rm -it -v $(pwd):/app composer/composer:1.1-alpine install. But, I need to execute some Bash codes before that, how can I achieve that?
You can enter a running container by running the command:
docker exec -it <container-name> sh

docker : can't mount some directory from host

I have the latest centos image for docker and the host machine is ubuntu.
i'm having some script at my host machine, with the path:
/home/username/untitled1/preReq.sh
i'm trying to execute this script, inside my centos docker.
while i'm mounting the directory of the script, i can't see anything and it appears that i'm mounting the root directory.
i'm using this command (from ~)
docker run --rm -it -v ${PWD}:/untitled1 centos
someone know how to fix it?
either use the pwd command (without caps) if you're in the directory:
docker run --rm -it -v ${pwd}:/untitled1 centos
or use $HOME environment variable if you're running with that user:
docker run --rm -it -v ${HOME}:/untitled1 centos
I would suggest
docker run --rm -it -v `pwd`:/untitled1 centos
At least that works for me.
${X}
evaluates the environment variable X. PWD is typically set by your shell:
$ export
[...]
declare -x PWD="/home/user"
[...]
pwd on the other hand is a program producing the current working directory to STDOUT:
$ whereis pwd
pwd: /bin/pwd /usr/include/pwd.h /usr/share/man/man1/pwd.1.gz
$ pwd
/home/user
With the previous docker command the program is executed and its STDOUT is inserted producing:
docker run --rm -it -v /home/user:/untitled1 centos

Mount a host file as a data volume in docker

I am following this docker user guide: Managing Data in Containers
It seem to be a error at "Mount a Host File as a Data Volume" part,
$ sudo docker run --rm -it -v ~/.bash_history:/.bash_history ubuntu /bin/bash
I test it in my mac version docker, it should be like this:
$ sudo docker run --rm -it -v ~/.bash_history:/root/.bash_history ubuntu /bin/bash
I am not sure if am I correct about this.
You can't use -v option with relative path. You need to use absolute path instead:
sudo docker run --rm -it -v /home/<your_user>/.bash_history:/.bash_history ubuntu /bin/bash

Resources