Space in path for docker-compose.yml - docker-compose

I am getting;
Error: Command failed: docker stack deploy --compose-file /Users/myUser/OneDrive - My Company/Code/myProject/node_modules/tools/lib/wdio/docker-compose.yml wdio
"docker stack deploy" requires exactly 1 argument.
I suspect the space in the path because the code is hosted on an MS OneDrive. I cannot change the name of the One Drive. Is there a way to get docker to handle the spaces correctly on a Mac/Unix?

You can try this:
docker stack deploy --compose-file /Users/myUser/OneDrive\ -\ My\ Company/Code/myProject/node_modules/tools/lib/wdio/docker-compose.yml wdio

Related

Deploy a private image inside minikube on linux

I am starting to use kubernetes/Minikube to deploy my application which is currently running on docker containers.
Docker version:19.03.7
Minikube version: v1.25.2
From what I read I gather that first of all I need to build my frontend/backend images inside minikube.
The image is available on the server and I can see it using:
$ docker image ls
The first step, as far as I understand, is to use the "docker build" command:
$docke build -t my-image .
However, the dot at the end, so I understand, means it is looking for a Dockerfile in the curretn directoy, and indeed I get an error:
unable to evaluate symlinks in Dockerfile path: lstat
/home/dep/k8s-config/Dockerfile: no such file or directory
So, where do I get this dockerfile for the "docker build" to succeed?
Thanks
My missunderstanding...
I have the Dockefile now, so I should put it anywhere and use docker build from there.

Docker Compose - invalid variable

I have docker compose yml file in my project file.
When try to run the below commend i get the below error.
docker-compose up
I get the below error message
invalid variable name "docker-compose.yml"
I have installed and uninstalled docker multiple times.
my Docker version - Docker version 20.10.8, build 3967b7d
my docker-compose version - Docker Compose version v2.0.0-rc.3
Check that your environment variables or .env file does not contain multiline variables (e.g. SSH keys). After flattening them, error should disappear. Source: https://github.com/Azure/aci-deploy/issues/29

keda func deploy from a dir which contains spaces is failing

I am using Visual Code with Azure Core Tools to deploy a container to a K8S cluster which has KEDA installed. But seeing this docker error. The error is caused because the docker build is run without the double quotes.
$ func kubernetes deploy --name bollaservicebusfunc --registry sbolladockerhub --python
Running 'docker build -t sbolladockerhub/bollaservicebusfunc C:\Users\20835918\work\welcome to space'....done
Error running docker build -t sbolladockerhub/bollaservicebusfunc C:\Users\20835918\work\welcome to space.
output:
"docker build" requires exactly 1 argument.
See 'docker build --help'.
Usage: docker build [OPTIONS] PATH | URL | -
Build an image from a Dockerfile
(.venv)
20835918#CROC1LWPF1S99JJ MINGW64 ~/work/welcome to space (master)
I know there is a known bug Spaces in directory
But posting to see if there is a workaround, this is important as I have eveything in Onedrive - Comapny Name and it has spaces in it
Looking into the code for func, you could specify --image-name instead of --registry which seems to skip building the container.
You would have to build your docker container manually using the same code shown in the output and provide the value for the -t argument of the docker command for --image-name of the func command after.
Also, since this would not push your docker container as well, make sure to push it before running the func command.

Docker-stack - get image always from the hub.docker.com

Summary: When I perform a 'docker stack deploy' in an AWS / EC2 environment the local (old) image is used. How can I overrule this behaviour to have the 'docker stack' use the new image from the hub.docker.com? As a workaround I first do a 'docker pull' of the image from index.docker.com before executing the 'docker stack deploy'. Is this extra step needed?
Situation:
On a Jenkins server (not on AWS / EC2) I have the following building steps:
Maven build
docker login -u ${env.DOCKER_USERNAME} -p ${env.DOCKER_PASSWORD}
docker build -t local-username/image-name:latest
docker tag local-username/image-name dockerhub-username/image-name:latest
docker push dockerhub-username/image-name:latest
The next steps in my Jenkinsfile are executed via a secure shell (ssh) on my AWS environement:
docker stack deploy -c docker-compose.yml stackname
When I execute this Jenkins job, the docker image is taken from the local image repo on AWS. I want to use the newest image put on hub.docker.com.
When I insert the following action BEFORE the 'docker stack deploy' everything works smoothly:
docker pull index.docker.io/dockerhub-username/image-name:latest
My questions:
Why do I need this extra 'docker pull' action?
How can I remove this action? Just by adding 'index.docker.io' in front of the image in the docker-compose.yml file? Or is there a better approach?
The extra docker pull should, of course not be needed.
What will help you?
The answer of #Tarun may work.
Or just name the Docker hub registry. Use the following line in your docker-compose.yml (stack) file
servicename:
image: index.docker.io/dockerhub-username/image-name
That will help you.
Maybe this is due to the fact that you build locally or on a separate Jenkins server, push the image to Docker hub and start on a remote shell on EC2. On that EC2 there is only a current image.
I tried the above solution for you, and it worked.
You can just execute the 'docker stack deploy' and the right image is used.

Windows console giving error when run as Container via docker RUN command

I created a Windows console app and in that console app I added Docker Orchestration support using "Docker Compose". When I run it by clicking on Docker Compose, it runs successfully
See in below image screenshot it shows I have added Docker file, I also have Docker Compose project. You can also see I have run by clicking "Docker Compose".
Now when I run it using Docker command as below
docker run -it consoleappcontainer:dev
It throws below error
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: container aedbd4bd0f60eb0184cce3570be103d121c516eac3cf222662258f6dd0ca0c50 encountered an error during CreateProcess: failure in a Windows system call: The system cannot find the file specified. (0x2)
[Event Detail: Provider: 00000000-0000-0000-0000-000000000000]
[Event Detail: Provider: 00000000-0000-0000-0000-000000000000]
[Event Detail: onecore\vm\compute\management\orchestration\vmhostedcontainer\processmanagement.cpp(174)\vmcomputeagent.exe!00007FF7303DC00A: (caller: 00007FF7303AECEA) Exception(2) tid(380) 80070002 The system cannot find the file specified.
CallContext:[\Bridge_ProcessMessage\ComputeSystemManager_ExecuteProcess\VmHostedContainer_ExecuteProcess]
Provider: 00000000-0000-0000-0000-000000000000] extra info: {"CommandLine":"C:\\app\\ConsoleAppContainer.exe","WorkingDirectory":"C:\\app","Environment":{"COMPLUS_NGenProtectedProcess_FeatureEnabled":"0"},"EmulateConsole":true,"CreateStdInPipe":true,"CreateStdOutPipe":true,"ConsoleSize":[50,192]}.
See error screenshot
Below is my DOCKER file
FROM microsoft/dotnet-framework:4.7.2-runtime-windowsservercore-1803
ARG source
WORKDIR /app
COPY ${source:-obj/Docker/publish} .
ENTRYPOINT ["C:\\app\\ConsoleAppContainer.exe"]
Why can't it find the EXE when it ran correctly using DOCKER COMPOSE button?
I don't know exactly what Visual Studio does when you run from there... see if there's something in the Output Window that could give you a hint...
One more thing, when docker compose is involved you should start it with docker-compose up. The docker-compose.yml file must have something that you're missing when you want to just start the container with docker run