How to run a meteor app in docker on mac? - macos

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.

Related

Why have I an error message "invalid reference format" when working with Docker?

I'm following the below tutorial and they use docker. I got an error When I tried to mount my local folder to the container.
https://www.youtube.com/watch?v=bhBSlnQcq2k
docker run --name some-nginx -v $(pwd):/usr/share/nginx/html:ro -d -p 8080:80 nginx
I got the following error:
docker: invalid reference format.
I am using Windows 10 PowerShell, Visual Studio Code, and Nginx image. Any ideas are highly appreciated.
with powershell you should use ${PWD} instead of $(pwd)
then you should do
docker run --name some-nginx -v ${PWD}:/usr/share/nginx/html:ro -d -p 8080:80 nginx
possible duplicate of : Mount current directory as a volume in Docker on Windows 10

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

docker sharing host directory

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

Run a docker image on Windows results in "oci runtime error: exec: "bash": executable file not found in $PATH."

I'm running Docker on Windows ("Docker Toolbox", not "Docker for Windows").
I've built an image with a rails app inside. It works properly on my Mac OS but stucks on production on Windows.
Using Docker 1.12 and docker-machine 0.8.0 on both machines.
When I create a machine and try to run the container from image, I do:
docker run -it myRepo:myTag bash
which opens me a interactive terminal on Mac OS, but Windows 7 and Windows Server 2011 are both responding with:
"Error response from daemon: oci runtime error: exec: "bash":
executable file not found in $PATH."
I use the MINGW64 shell via the Docker Quickstart Terminal but the old cmd.exe returns the same.
Can anybody help me with this issue? I've tried several hours to find a solution but there are too few answers for Windows.
Thank you in advance!
I also use Windows 7 with MINGW64. Here is what I get using nginx as example:
$docker run -it nginx bash
cannot enable tty mode on non tty input
I don't think you can open a tty using MINGW64.
You can try:
$docker run -i nginx bash
ls
bin
...
You will so no prompt or any indication you are inside the container. Just run ls and it should work inside your container.
Another option is to try to use winpty for the tty:
$ winpty docker run -it myRepo:myTag bash
root#644f59e6f818:/#
Have you tried?
$ winpty docker run -it myRepo:myTag /bin/bash
I haven't got the problem you are mentioning but I have seen it before when I was mapping volumes.
If you are mapping volumes using MINGW64, you will need to add an extra / before the local mapping. For example:
docker run -p 8080:80 -v "/$PWD":/var/share/nginx/html nginx
Let me know your findings.

'docker run -v' does not work on Windows using Docker Toolbox

When running the following command from a CoreOS VM, it works as expected:
docker run --rm -v $PWD:/data composer init
It will initialize the composer.json file in the current working directory by using the Docker volume mapping as specified. The Docker container basically has the PHP tool composer installed and will run that tool inside the /data folder of the container. By using the mapping it actually applies it on the files on the host machine.
However when trying to run this command on Windows using Docker Toolbox I get the following error.
$ docker run --rm -v $PWD:/data composer --help
invalid value "C:\\Users\\Marco;C:\\Program Files\\Git\\data" for flag -v: bad mount mode specified : \Program Files\Git\data
See 'C:\ProgramData\Chocolatey\lib\docker\bin\docker.exe run --help'.
What I notice here is although I am in Git Bash when executing the command it still uses Windows paths. So then I tried following (surround with quotes):
$ "docker run --rm -v $PWD:/data composer --help"
bash: docker run --rm -v /c/Users/Marco:/data composer --help: No such file or directory
Now it is unable to find the directory.
I also tried without the $PWD variable, but this doesn't make a difference.
How do I make this work on Windows?
This should work:
$ docker run --rm -v //c/Users/Marco:/data composer --help
Try MSYS_NO_PATHCONV=1 docker run ...
Git Bash tries to convert the path for other Windows commands.

Resources