Running Docker using ConEmu - windows

This is my ConEmu task setting
Task parameters: /dir "C:\Program Files\Docker Toolbox"
Commands: "%ProgramFiles%\Git\bin\bash.exe" --login -i -new_console:C:"C:\Program Files\Docker Toolbox\docker-quickstart-terminal.ico" "%ProgramFiles%\Docker Toolbox\start.sh"
This is the result, I can see the whale but I cannot use any docker command, I got error: bash: docker.exe: command not found
Please help, thanks
I'm using Windows 10, Docker Toolbox 1.11.1

Just add Docker's path to PATH.

I had a similar issue in Windows 7 with running the Quickstart Terminal, I was getting the same error. After making sure Docker's path was in PATH, I tried running the Quickstart Terminal as administrator and it works fine.
I couldn't find anything online about it, but running as administrator works, but non-admin always gets the error that you got.

Related

How to launch InstaSafe Agent application with a bash command?

I am using Ubuntu Linux 20.04
I am using an application named InstaSafe Agent which connects me to a VPN.
App Logo:
I want to automate this login process.
For that, I am looking for bash command to run this application from terminal.
this is how it looks when I open this application.
I have tried to find its installation path like this.
Command: whereis instasafe
output: instasafe: /etc/instasafe
Can Someone let me know how can I run this application using bash command?
If you have installed InstaSafe using default settings,
you can try this command.
This worked for me.
/usr/bin/java -jar /opt/instasafe/isaagent-1.0.jar

Docker fails to start on Windows 11 with WSL

I searched on SO for similar questions already, and none of the answers helped.
I installed and uninstalled docker many times and restarted every time. I set the env variable, and I can run docker, and see that it's installed in terminal, but the GUI won't startup.
This is the error I get when trying to run a hello world command.
docker: error during connect: In the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect.: Post "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/containers/create": open //./pipe/docker_engine: The system cannot find the file specified.
I am running it on a Windows 11 Home version.
Any help is appreciated.
Seems like and issue with the new Docker release. After I downgraded I was able to get it too work. Docker version 4.4.4.
Make sure you allow virtualization too, by running the following command in powershell as Admin: bcdedit /set hypervisorlaunchtype auto

docker commands not found

I installed docker in Mac and it is installed successfully.
Also it is running.
And tried to execute the below command in terminal
docker -v
See the below error:
-bash: docker: command not found
How do I solve this issue.
In windows those commands are working fine.
If you successfully installed docker using the official package, the command should be available under /usr/local/bin/docker.
That directory might not yet be in your $PATH, so you could try adding export PATH="/usr/local/bin:$PATH" to your .bashrc / .bash_profile.

Azure, Windows 8.1, Docker: az commands does not work in docker toolbox

I did:
install Azure/azure cli 2.0
update Path
install Docker toolbox to have ability to run "Docker quickstart terminal" under windows 8
Actual result: azure commands, like az acr, are normally running under cmd/powershell, but not running just in docker quickstart terminal:
$ az
bash: az: command not found
Expected result: I want to have ability to run "az" commands family just in docker toolbox ("Docker Quickstart Terminal") on windows 8.
How to achieve this?
I found solution - using alias, e.g.
alias az='"C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe" -Im azure.cli'
If You have better variants - please add. I will close question as answered in few days
The issue is because the azure cli 2.0 is installed in location, and this path isn't added to the PATH variable.
So you should add the PATH to windows Environment Variables -> Path.
Here is my path:
Hope this helps.

Unable to run cygwin in Windows Docker Container

I've been working with Docker for Windows, attempting to create a Windows Container that can run cygwin as the shell within the container itself. I haven't had any luck getting this going yet. Here's the Dockerfile that I've been messing with.
# escape=`
FROM microsoft/windowsservercore
SHELL ["powershell", "-command"]
RUN Invoke-WebRequest https://chocolatey.org/install.ps1 -UseBasicParsing | Invoke-Expression
RUN choco install cygwin -y
RUN refreshenv
RUN [Environment]::SetEnvironmentVariable('Path', $env:Path + ';C:\tools\cygwin\bin', [EnvironmentVariableTarget]::Machine)
I've tried setting the ENTRYPOINT and CMD to try and get into cygwin, but neither seems to do anything. I've also attached to the container with docker run -it and fired off the cygwin command to get into the shell, but it doesn't appear to do anything. I don't get an error, it just returns to the command prompt as if nothing happened.
Is it possible to run another shell in the Windows Container, or am I just doing something incorrectly?
Thanks!
You don't "attach" to a container with docker run: you start a container with it.
In your case, as seen here, docker run -it is the right approach.
You can try as an entry point using c:\cygwin\bin\bash, as seen in this issue.
As commented in issue 32330:
Don't get me wrong, cygwin should work in Docker Windows containers.
But, it's also a little paradoxical that containers were painstakingly wrought into Windows, modeled on containers on Linux, only for people to then want to run Linux-utils in these newly minted Docker Windows containers...
That same issue is still unresolved, with new case seen in May and June 2018:
We have an environment that compiles with Visual Studio but still we want to use git and some very useful commands taken from linux.
Also we use of-the-shelve utilities (e.g. git-repo) that uses linux commands (e.g. curl, grep,...)
Some builds require Cygwin like ICU (a cross-platform Unicode based globalization library), and worst: our builds require building it from source.
You can see an example of a crash in MSYS2-packages issue 1239:
Step 5/5 : RUN "C:\\msys64\\usr\\bin\\ls.exe"
---> Running in 5d7867a1f8da
The command 'cmd /S /C "C:\\msys64\\usr\\bin\\ls.exe"' returned a non-zero code: 3221225794
This can get more information on the crash:
PS C:\msys64\usr\bin>
Get-EventLog -Index 28,29,30 -LogName "Application" | Format-List -Property *
The workaround was:
PS > xcopy /S C:\Git C:\Git_Copy
PS > C:\Git_Copy\usr\bin\sh.exe --version > v.txt
PS > type v.txt
As mentioned in that thread, the output gets lost somewhere in the container, thus sending it to a text file.
After playing with it for a long time, my findings were the following:
If your Cygwin utilities are crashing your container, you need to use process isolation. See https://learn.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/version-compatibility for the requirements (essentially you need to use Windows Server 2016 and a build-matching Docker Image). I spent some time trying to understand the reason why hyper-v isolation doesn't work and so far I didn't come to any conclusion;
If your Cygwin utilities apparently do nothing - but they don't crash the container - you need to remove the -t flag (the -i flag is still ok) or alternatively play with stdout redirection. Apparently there seems to be an issue with MSYS2 when it deals with some pseudo-ttys. You can verify that programs still run if you redirect stdout to a file (e.g. whoami won't output anything when you run it without any stdout redirection, but whoami > out.txt will output the expected result to a file). It might be possible to fix this by replacing the pseudo-tty but I didn't try it. I suspect that the problem is an invalid handle somewhere inside the MSYS2 libs - as other console apps can print things to the terminal - but I didn't verify this.
Hope it helps to all of you having the same problem.
I was able to get a preinstalled (copied from the host) copy of Cygwin to work in a nanoserver-based container with these two steps:
Using Żubrówka's recommendation for no -t in the docker run cmd-line (when running docker interactively)
Copying the host's (Windows Server 2016) kernel32.dll to the container's c:\windows\system32
I found serveral versions of kernel32.dll on my system, and used the one from c:\windows\system32 with md5 hash d8948a7af764f7153b3e396ad44992ff
This also made a large variety of other executables work. Note that without a tty, using the container is even more cumbersome, and the bash shell doesn't render the prompt. However, scripts (via Jenkins, in my case) that rely on cygwin components work fine.
If that doesn't help, try this guide, it helped me a lot. If your windows application (other than cygwin) is legitimately missing DLLs, the instructions in this guide can help. It never occurred to me that SysInternals' procmon.exe can be run on the host and still report events from the container!

Resources