Using docker context to a mac - docker

I had been trying to create a context to deploy a few containers from my main Mac to another another but I have been getting a weird error.
So, I have two Macs, one iMac (Late 2013) (here will be called Enterprise) and one Macbook Pro (Mid 2015) (here will be called Defiant). Defiant is my main computer and I want to deploy my container to Enterprise in order to not overload Defiant memory. I have been working with docker context to achieve that. Currently, I have Enterprise running Docker v20.10.16 and Defiant running v20.10.16.
I have created the context on Defiant and after I run the docker context use enterprise and when I run docker container ls I get the following error:
error during connect: Get "http://docker.example.com/v1.24/containers/json": command [ssh -l rafaelguerra -- Enterprise.local docker system dial-stdio] has exited with exit status 127, please make sure the URL is valid, and Docker 18.09 or later is installed on the remote host: stderr=zsh:1: command not found: docker
Does anyone know how to make it work?
Thanks
UPDATE:
Weird thing I just found out, when logged into Enterprise and run echo $PATH returns /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin however when I run ssh rafaelguerra#enterprise.local 'echo $PATH' I got the following /usr/bin:/bin:/usr/sbin:/sbin
I don't have a clue for a reason for this.

I found the reason for the problem, all commands docker run are run within ssh not with a permanent ssh session. So, zsh does not load the correct PATH when the command is run within the ssh. Therefore, the only thing I need to do was setting the correct PATH inside of the ~/.zshenv file and everything is working now.

Related

How to solve this Error response from daemon [duplicate]

While I am trying to start with docker on my windows 10 machine it is returning the following error.
ERROR: open \.\pipe\docker_engine_linux: The system cannot find the file specified.
I found when I logon to my computer, the hyper VM could not run docker virtual machine automatically though my docker desktop is running. Once I start docker virtual machine on hyper VM and restart docker once again, it works okay. But this is not a permanent solution. Could I get some help please?
Restarting Docker Desktop for Windows helped me. You can do that by right-click on tray icon and selecting restart.
The same problem with Me. I am writing this command in PowerShell Run As Administrator. Switch Docker from Windows to Linux and write the command like this:
cd "C:\Program Files\Docker\Docker"
./DockerCli.exe -SwitchLinuxEngine
This is the Simple way to solve this.
In my case, the reason for the error was even easier than the main answer ("close and open it again") suggests. Docker Desktop was just not running anymore!
When I hovered over the tray icon, it vanished.
Further details:
Docker Desktop had crashed, or it was closed because of a forced update. I had this problem after updating Java runtime environment.
When I opened Docker Desktop then, an update ran, and I could not even choose between yes or no, running for at least 5 minutes with the tray icon only showing "Docker Desktop is starting". The menu had crashed as well.
Update 10 / 2022
I solved this issue by restarting WSL, as only restarting Docker was not solving it for me.
In my situation, Docker was running as expected before encountering this issue.
These are the steps I took
Close Docker Desktop
Open cmd and run wsl --shutdown
Start Docker Desktop and press Restart on the notification below
(It should pop up in a few seconds)
I am able to auto trigger docker VM start on Hyper V by enabling the following in setting :
While the error below error continuing till docker starts okay and containers are running okay.
ERROR: open .\pipe\docker_engine_linux: The system cannot find the file specified.
Try running the below commands in the Powershell and start the docker
Net stop com.docker.service
And then
Net start com.docker.service
My Docker Desktop was sort of freezing and was not starting up. Just kept showing Starting... for ever. Any docker command in terminal was throwing same exception "Error response from daemon: open \.\pipe\docker_engine_linux:". I tried some options a mentioned above, didn't worked on Windows 10. I just went to Windows Services ( In search box type "services"). Look for "Docker Desktop Service". Stop and Start it once. Then try starting your Docker Desktop again. It came up back super fast.
Try to add the folder with your project in Settings -> Resources -> File Sharing. And click the button Apply & Restart
I was facing the same issue while installing docker on windows 10. Later I could resolve the issue by updating the Linux kernel.
Go to this link and update the package for x64 machine
https://learn.microsoft.com/en-us/windows/wsl/install-win10#step-4---download-the-linux-kernel-update-package
One way of solving this problem is doing the following step again every time you open your pc:
# -------------------- enable the wsl for linux on windows ------------------- #
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
# ---------------------- enable virtual machine feature ---------------------- #
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
# ------------------------ set wsl as default version ------------------------ #
wsl --set-default-version 2
and then start docker desktop icon
and docker engine will start without any porblem
Tried a lot of things.
Helped:
Close Docker.
Start Docker as administrator.
In my case Docker Desktop was running fine but when I run docker pull for window image where as I also set switch to window container as well But I face this error Error response from daemon: open \.\pipe\docker_engine_linux: The system cannot find the file specified
Finally I fixed it by running the below command in powershell as an administrative mode
Enable-WindowsOptionalFeature -Online -FeatureName $("Microsoft-Hyper-V", "Containers") -All
I was getting similar problem on window 10 so what i uninstall the verison 4.16 and install old version 4.13.
From setting update of docker desktop i click on update to latest version and after it works
Created all file that were missing earlier
I have my cloudflare WARP running that was causing this issue I just toggled it off and it worked.
I updated docker to the latest version. Error has gone.
to solve this problem make sure you install one of the linux distribution like alpine or ubunto and that step alot of youtube vedio tutorial miss nowaday in 2022 and by the way this step is menthoned in the https://learn.microsoft.com/en-us/windows/wsl/install-manual and i mean here the step number 6 in the manual installation of windows subsystem for linux as short wsl => https://learn.microsoft.com/en-us/windows/wsl/install-manual
WSL 2 Installation was incomplete. After doing a 'restart' on Docker, it prompted me to get the Linux Kernel installed.
This message appeared while using IntelliJ service. Solutions for me was that Docker installed in windows should also be running and showing list of container. Once Docker desktop app shows container list. This docker was connected to intellij and error message was gone.
Purging data of HYPER-V, WSL 2 and Windows Containers did the trick for me. Purge data section is in troubleshooting.
I had the same issue ,I uninstalled the latest version and Installed Docker desktop 4.13, my problem is solved.
here is the download link :
https://desktop.docker.com/win/main/amd64/89412/Docker%20Desktop%20Installer.exe
Update Jan 2023
Follows up with #Michiel Pater's solution, in case wsl --shutdown hangs in your terminal, open task manager as administrator, find Windows Subsystem for Linux then kill it. After serveral seconds, press Restart from Docker Desktop notification
Error is resolved with latest Docker for Windows release 4.16.3 from 30. of January 2023.
Check here for details.
Solution For:
Docker forever in "Docker is starting.." at Windows task
Docker desktop is starting error
Docker "unable to calculate image disk size"
unable to calculate disk size docker
failed to ping VM diagnosticsd with error:
Get "http://ipc/ping": open \.\pipe\dockerDiagnosticd: The system
cannot find the file specified.
The same problem with Me in 2023. I am writing this command in PowerShell Run As Administrator. Switch Docker from Windows to Linux and write the command like this:
cd "C:\Program Files\Docker\Docker"
./DockerCli.exe -SwitchLinuxEngine
This is the simplest and best way to solve this.
ERROR:
C:\Users\user1>docker run hello-world
docker: Error response from daemon: open \.\pipe\docker_engine_linux: The system cannot find the file specified.
See 'docker run --help'.
solution:
use this command => cd "C:\Program Files\Docker\Docker"

"Docker Desktop Starting..." forever on Windows

I have installed Docker Desktop version 4.4.4 and it is not running. It only displays "Docker Desktop Starting ..." but never starts running.
I have tried so many ways but didn't solve:
Allowing the following files in windows firewall C:\program files\docker\docker\resources\vpnkit.exe, C:\program files\docker\docker\com.docker.service C:\program files\docker\docker\resources\com.docker.proxy.exe
Removing 'Docker' and 'Docker Desktop' folders from AppData/Roaming and AppData/Local
Uninstalling and reinstalling Docker with different versions including 4.5.1
The main problem is WSL2 does not auto install the kernel when WSL2 installs, yet Docker Desktop expects it already installed. So, fully close & stop Docker as other answers have said, then run this cmd as admin:
wsl --update
Now open Docker Desktop & it should start up ok.
I've found out another symptom leading to the solution is also related to WSL.
On one side, Docker service won't start throwing this error:
error during connect: This error may indicate that the docker daemon
is not running.: Get
"http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/version": open
//./pipe/docker_engine: The system cannot find the file specified.
And on the other, WSL is unresponsive. Attempting to run a WSL Distro or WSL command directly on CMD, won't return any output at all. It will just hang in there.
So the solution is common to WSL and Docker.
I've found in a question regarding the WSL issue, that the LxssManager Windows service is staled (it may show under services.msc as Stopping and all the buttons are greyed out, or I've even seen it Running apparently, but with the Docker and WSL issues above, so something is wrong with it still.)
First, we have to get LxssManager PID in order to kill it. Using an elevated shell, we can get it this way:
sc queryex LxssManager
Having the PID, we can kill the process but beware I wasn't able to kill it using kill or taskkill commands. I was getting the following error:
ERROR: The process with PID XXXXX could not be terminated.
Reason: Access is denied.
To effectively kill the process, do as following:
wmic process where ProcessID=XXXXX delete
Replace XXXXX with PID, of course.
Having done so, start the LxssManager service:
net start LxssManager
A word of warning:
I've noted in some cases this is not enough for unknown (to me) technical reasons even if LxssManager service is shown as Running.
Just repeat the above steps! Sometimes it works doing this once, sometimes doing it twice for some reason.
TL;DR
Kill LxssManager Windows service using wmic+PID.
Start LxssManager service.
Repeat twice or more if issues persist.
Docker and WSL issues are solved.
Here i am using Windows platform, I faced this issue.
And to resolve this issue follow the below steps.
Just delete the temporary files from the following.
C:\Windows\Temp
C:\Users{yourAccountName}\AppData\Local\Temp
C:\Windows\Prefetch
then
Uninstall Docker Desktop
Restart computer
before installing docker, make sure you have Ubuntu WSL(download from Microsoft store)
[optional] If you need Terminal Preview(multi-terminal) download from Microsoft Store. Great Terminal
Install Docker Desktop Again
Thanks
For me, it was a problem with WSL. When I tried:
wsl --install -d Ubuntu
in a command window, after a few minutes I got error 0x80370114
The fix was to do:
Exploit Protection > System Settings > Control Flow Guard
turn on
restart computer
Then reinstall/restart Docker Desktop, and it works!
Hope this helps someone else
I was facing same code for for Docker version 4.*. For me it was Visual Studio code,
Stopped WSL form Task manager
stopped Docker which was showing "Docker desktop is starting" form Task manage
stopped Visual Studio code form Task manager
Started Docker again
These steps placed my Docker in Running state in 30 seconds
Hope this helps someone!
Solved this issue with #Alvi answer
Docker forever in "Docker is starting.." at Windows task
I guess you are using wsl2 features. In that case, open PowerShell or command prompt and type: optionalfeatures.exe
scroll down and uncheck
Windows Subsystem for Linux
apply the changes and restart your computer.
After restart follow the previous steps again and check
Windows Subsystem for Linux
and restart again. Hopefully now your docker will run
My fresh install was experiencing the same symptoms. Also wsl --list showed "no installed distributions". I tried many reinstallations and restarts of Docker and WSL, but eventually found the steps:
In Task Manager, kill all processes related to Docker & Docker Desktop
Run Docker Desktop as administrator
Got it working on on Windows 11 Enterprise.
for me it worked in windows (docker desktop):
to uninstall the docker
reinstall as administrator
don't select the part with wsl
As wrote here, you need to do:
wsl --update
But after that it doesn't fix my issue until I did restart to my pc.
What worked for me was to log in into the Docker (upper right corner), but when I first clicked on login, it said "exec: "rundll32": executable file not found in %PATH%" - I search and found that I need to check environmental variable in PATH that I have "C:\WINDOWS\system32" there - (and in my case I really had it broken somehow - don't know why, but I missed backslash between Windows and system32). So I fixed to correct path, restarted PC. Then I was able to login. And immediately "Docker Desktop Starting..." was gone.
I use Docker with PyCharm. I ran into this problem when I launched PyCharm and Docker Desktop at about the same time.
On my machine Docker Desktop starts automatically when I boot. I can avoid the problem by waiting for Docker Desktop to finish starting. And then start PyCharm.
I was also having the same problem, just a few minutes ago.
Platform:
Windows 10 Pro - 22H2 - Build 19045.2486
Windows Updates newly installed: KB5022282, KB5020876, KB5012170
What i did was: Activating the Windows Hypervisor Platform
And it did solve the problem, atleast for now
In my case it helped me to enable the CPU SVM (Support Vector Machine) function in my BIOS settings.
Also, if you have this feature disabled, you will not be able to use Virtual Box either.
SVM in BIOS
got to services and stop Docker desktop service and start again
reopen Docker desktop it will work
wsl -v
if it show version then linx is install
search windows programer feature in your laptop
enable virtulization
wsl --set-default-version 2
restart laptop and then start docker and wait for 2 minutes your docker will start working
I am running windows 11, visual studio 2023 and had this issue.
First, open a command prompt and type
wsl.exe --list --online
Then enter following
wsl.exe --install Ubuntu-20.04
Then type in the prompt sudo apt update to update the distribution. Lastly, start up Docker desktop and log in (you can register at their site). That fixed Docker on my pc.

Error response from daemon: open \\.\pipe\docker_engine_linux: The system cannot find the file specified

While I am trying to start with docker on my windows 10 machine it is returning the following error.
ERROR: open \.\pipe\docker_engine_linux: The system cannot find the file specified.
I found when I logon to my computer, the hyper VM could not run docker virtual machine automatically though my docker desktop is running. Once I start docker virtual machine on hyper VM and restart docker once again, it works okay. But this is not a permanent solution. Could I get some help please?
Restarting Docker Desktop for Windows helped me. You can do that by right-click on tray icon and selecting restart.
The same problem with Me. I am writing this command in PowerShell Run As Administrator. Switch Docker from Windows to Linux and write the command like this:
cd "C:\Program Files\Docker\Docker"
./DockerCli.exe -SwitchLinuxEngine
This is the Simple way to solve this.
In my case, the reason for the error was even easier than the main answer ("close and open it again") suggests. Docker Desktop was just not running anymore!
When I hovered over the tray icon, it vanished.
Further details:
Docker Desktop had crashed, or it was closed because of a forced update. I had this problem after updating Java runtime environment.
When I opened Docker Desktop then, an update ran, and I could not even choose between yes or no, running for at least 5 minutes with the tray icon only showing "Docker Desktop is starting". The menu had crashed as well.
Update 10 / 2022
I solved this issue by restarting WSL, as only restarting Docker was not solving it for me.
In my situation, Docker was running as expected before encountering this issue.
These are the steps I took
Close Docker Desktop
Open cmd and run wsl --shutdown
Start Docker Desktop and press Restart on the notification below
(It should pop up in a few seconds)
I am able to auto trigger docker VM start on Hyper V by enabling the following in setting :
While the error below error continuing till docker starts okay and containers are running okay.
ERROR: open .\pipe\docker_engine_linux: The system cannot find the file specified.
Try running the below commands in the Powershell and start the docker
Net stop com.docker.service
And then
Net start com.docker.service
My Docker Desktop was sort of freezing and was not starting up. Just kept showing Starting... for ever. Any docker command in terminal was throwing same exception "Error response from daemon: open \.\pipe\docker_engine_linux:". I tried some options a mentioned above, didn't worked on Windows 10. I just went to Windows Services ( In search box type "services"). Look for "Docker Desktop Service". Stop and Start it once. Then try starting your Docker Desktop again. It came up back super fast.
Try to add the folder with your project in Settings -> Resources -> File Sharing. And click the button Apply & Restart
I was facing the same issue while installing docker on windows 10. Later I could resolve the issue by updating the Linux kernel.
Go to this link and update the package for x64 machine
https://learn.microsoft.com/en-us/windows/wsl/install-win10#step-4---download-the-linux-kernel-update-package
One way of solving this problem is doing the following step again every time you open your pc:
# -------------------- enable the wsl for linux on windows ------------------- #
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
# ---------------------- enable virtual machine feature ---------------------- #
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
# ------------------------ set wsl as default version ------------------------ #
wsl --set-default-version 2
and then start docker desktop icon
and docker engine will start without any porblem
Tried a lot of things.
Helped:
Close Docker.
Start Docker as administrator.
In my case Docker Desktop was running fine but when I run docker pull for window image where as I also set switch to window container as well But I face this error Error response from daemon: open \.\pipe\docker_engine_linux: The system cannot find the file specified
Finally I fixed it by running the below command in powershell as an administrative mode
Enable-WindowsOptionalFeature -Online -FeatureName $("Microsoft-Hyper-V", "Containers") -All
I was getting similar problem on window 10 so what i uninstall the verison 4.16 and install old version 4.13.
From setting update of docker desktop i click on update to latest version and after it works
Created all file that were missing earlier
I have my cloudflare WARP running that was causing this issue I just toggled it off and it worked.
I updated docker to the latest version. Error has gone.
to solve this problem make sure you install one of the linux distribution like alpine or ubunto and that step alot of youtube vedio tutorial miss nowaday in 2022 and by the way this step is menthoned in the https://learn.microsoft.com/en-us/windows/wsl/install-manual and i mean here the step number 6 in the manual installation of windows subsystem for linux as short wsl => https://learn.microsoft.com/en-us/windows/wsl/install-manual
WSL 2 Installation was incomplete. After doing a 'restart' on Docker, it prompted me to get the Linux Kernel installed.
This message appeared while using IntelliJ service. Solutions for me was that Docker installed in windows should also be running and showing list of container. Once Docker desktop app shows container list. This docker was connected to intellij and error message was gone.
Purging data of HYPER-V, WSL 2 and Windows Containers did the trick for me. Purge data section is in troubleshooting.
I had the same issue ,I uninstalled the latest version and Installed Docker desktop 4.13, my problem is solved.
here is the download link :
https://desktop.docker.com/win/main/amd64/89412/Docker%20Desktop%20Installer.exe
Update Jan 2023
Follows up with #Michiel Pater's solution, in case wsl --shutdown hangs in your terminal, open task manager as administrator, find Windows Subsystem for Linux then kill it. After serveral seconds, press Restart from Docker Desktop notification
Error is resolved with latest Docker for Windows release 4.16.3 from 30. of January 2023.
Check here for details.
Solution For:
Docker forever in "Docker is starting.." at Windows task
Docker desktop is starting error
Docker "unable to calculate image disk size"
unable to calculate disk size docker
failed to ping VM diagnosticsd with error:
Get "http://ipc/ping": open \.\pipe\dockerDiagnosticd: The system
cannot find the file specified.
The same problem with Me in 2023. I am writing this command in PowerShell Run As Administrator. Switch Docker from Windows to Linux and write the command like this:
cd "C:\Program Files\Docker\Docker"
./DockerCli.exe -SwitchLinuxEngine
This is the simplest and best way to solve this.
ERROR:
C:\Users\user1>docker run hello-world
docker: Error response from daemon: open \.\pipe\docker_engine_linux: The system cannot find the file specified.
See 'docker run --help'.
solution:
use this command => cd "C:\Program Files\Docker\Docker"

Docker commands and setup running successfully yesterday started giving error "ENOENT" today suddenly on windows 10

I am relatively new for the docker technology.
Yesterday I setup docker on windows 10 machine and ran few dockers.
Today I first used command "docker system prune" so that I can run all of it once again without any conflicts.
But now I am firing below command:
docker run --name DockerName -v /c/collections:/etc/newman -t
postman/newman:ubuntu run
"MyAPITestCollection.postman_collection.json"
--environment="MyAPITestEnvironment.postman_environment.json" --reporters="json,cli" --reporter-json-export="reports/MyAPITestReport.json"
And getting below error:
error: ENOENT: no such file or directory, open 'MyAPITestEnvironment.postman_environment.json'
I haven't made any changes to the directories or anything else.
I checked the docker desktop setup option and found that the drive on which the file is located is still showing as the shared drive.
I tried by restarting the docker desktop several times and once by rebooting the machine as well but still found same error.
Kindly requesting to help me figure out the root cause of this issue and the solution as well.
My docker network had once again become public so firewall might be preventing the file access.
I changed it to private by using below command and it ran successfully:
Set-NetConnectionProfile -interfacealias "vEthernet (DockerNAT)" -NetworkCategory Private

Docker windows save to filesystem

I'm having a docker application that writes to the local filesystem on a windows machine.
When I run/debug the application from Visual Studio it works, but when I then run the image in docker I get "Could not find part of the path". And that is usually an indication of insufficient rights to write in that folder.
But now I'm confused, is it not in both circumstances using my credentials?
Anyway in an attempt I have tried to give everyone full control, but still the same error.
Aha, it turns out to be that when I do the docker run command I have to use the -v parameter
Like this:
docker run --rm -it -v c:\hostcontainershare:c:\containertmp myconsoleapplication ".NET Framework App Writing to Host Folder" 1
I found the explanation here: https://msdn.microsoft.com/en-us/magazine/mt814415.aspx
And when you run it from Visual Studio, it apparently does that automatically for you.

Resources