docker sharing host directory - windows

I used to share my host diretory with a docker container with the command (osx):
docker run --name tensorflower -it -p 8888:8888 -v /c/foo/labs:/home tensorflow/tensorflow
on windows it used to work with:
docker run --name tensorflower -it -p 8888:8888 -v //c/foo/labs:/home tensorflow/tensorflow
But now it does not work on windows. I tried both -v variants. As I do not get any error messages, I have no glue where to dig in to solve the problem.
How can I share the host directory c:\foo\labs with my docker container?
Or at least get some more informaton regarding the error?
Docker version 17.09.1-ce, build 19e2cf6 on windows 10

Related

How do I get Docker to mount VM volumes on OSX

I apologize if this is better on serverfault or ask different, it's not immediately clear to me where this question belongs.
I'm currently running docker for mac and I have a pretty strong understanding of how to mount folders from my OSX host machine inside of running docker containers. My understanding is that docker is achieving this by running a Linux VM and handling the mounting between the VM and the host machine.
What I want to do is mount folders from the VM inside of my running container.
I can sort of accomplish this by running docker from inside of docker:
docker run --privileged \
-it \
-v /var/run/docker.sock:/var/run/docker.sock \
ubuntu-docker-client#sha256:038874e2c9c663550c9ddb0c8eb814c88d8a264cd1a5bfb4305dec9282598094 \
/bin/bash -c "docker run --net=host --ipc=host --uts=host --pid=host -it --security-opt=seccomp=unconfined --privileged --rm -v /:/host alpine /bin/sh -c 'chroot /host && /bin/sh'"
This handles the problem by escaping the chroot jail from inside a running container through the use of privileged containers.
I was hoping to find a solution which was less invasive and allowed me to mount volumes from both the host machine (OSX) and the linux VM.

Issue running project using docker

I am trying to install docker in my windows machine and run the project with given command.
docker run -it -p 8000:80 --rm -v "$PWD":/var/www/html registry.XXXXXX/docker-images/legacy-admin:master
I am running windows so instead of $PWD, I used D:/projects/
But I am getting the following error
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: invalid reference format.
See 'C:\Program Files\Docker\Docker\Resources\bin\docker.exe run --help'
docker run -it -d -p 8000:80 --rm -v "$PWD":/var/www/html registry.XXXXXX/docker-images/legacy-admin:maste
Try running above lines

ubuntu 18.04 docker container

i'm runnung docker on windows 10 desktop. i like to run ubuntu 18.04 docker container. i have pulled ubuntu and ran following docker command
Docker up -d ubuntu
i'm not seeing image running when i check
docker ps
instead i see image stopped when i check
docker ps -a
why it is like this.? like other images i should see ubuntu running when i check
docker ps
just like wordpress or mysql images.
also i like to mount volume to ubuntu container by using -v tag. let me know if following command is correct or not
docker up -d --name ubuntu -p 80:80 -p 22:22 -v /ubuntu:/home ubuntu

how to mount windows directory to a windows container

I am trying to mount a windows directory inside a windows docker container that runs with image microsoft/aspnetcore-build:2.0
I tried below commands
docker run -it microsoft/aspnetcore-build:2.0 -v dotnetcore:c:\dotnet
docker run -it microsoft/aspnetcore-build:2.0 -v dotnetcore:c:
docker run -it microsoft/aspnetcore-build:2.0 -v dotnetcore:c:\\
docker run -it microsoft/aspnetcore-build:2.0 -v dotnetcore
docker run -d microsoft/aspnetcore-build:2.0 -v dotnetcore:c:\\dotnet
All the above commands threw the error
docker: Error response from daemon: container 66e8c16cdf607c9e7ecb049963c602d22c9850f331e3d08c3acc557db4d40814 encountered an error during CreateProcess: failure in a Windows system call: The system cannot find the file specified. (0x2) extra info: {"CommandLine":"-v dotnetcore:c:\\dotnet","WorkingDirectory":"C:\\","Environment":{"ASPNETCORE_PKG_VERSION":"2.0.8","ASPNETCORE_URLS":"http://+:80","DOTNET_RUNNING_IN_CONTAINER":"true","DOTNET_SDK_DOWNLOAD_SHA":"5cae6f4c577182e7d84d991b9d20162c1a76ce17f65b7b52a7e6df8d98ec389e03626f61969eaed4f23a5f6c96a3ab188e71a0b94cc58f86e485ac9296c4af64","DOTNET_SDK_DOWNLOAD_URL":"https://dotnetcli.blob.core.windows.net/dotnet/Sdk/2.1.200/dotnet-sdk-2.1.200-win-x64.zip","DOTNET_SDK_VERSION":"2.1.200","DOTNET_USE_POLLING_FILE_WATCHER":"true","NODE_DOWNLOAD_SHA":"3d3d72c5c93a50d5a19f65f0de196b5237792a99b89fac2b61e62da4f566c842","NODE_VERSION":"6.13.0","NUGET_XMLDOC_MODE":"skip","RestoreUseSkipNonexistentTargets":"false"},"EmulateConsole":true,"CreateStdInPipe":true,"CreateStdOutPipe":true,"ConsoleSize":[30,131]}.
Any help to resolve this will be highly appreciated
You need to put -v parameter before image name

How to run a meteor app in docker on mac?

I am trying to run a meteor app in a docker container on my mac using the meteord base image, but getting a
=> You don't have an meteor app to run in this image.
error message when
$ docker run -it -e ROOT_URL=http://localhost -e MONGO_URL=mongodb://192.168.99.101:27017/meteor -v /Users/me/build/bundle -p 8080:80 meteorhacks/meteord:base
I built the meteor bundle by
$ meteor build --architecture=os.linux.x86_64 ./
Can I use meteord on the mac?
As you can see in base/scripts/run_app.sh#L3-L21, that error message pops up when there is no /bundle, $BUNDLE_URL or /build_app path in the container.
And -v /Users/me/build/bundle isn't enough to declare a /bundle path in the container: you need to map it (mount a host directory):
-v /Users/me/build/bundle:/bundle
-v /Users/me/build/bundle alone declares a data volume, it doesn't mount anything from the host.

Resources