docker cannot run in visual studio - asp.net

error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.26/containers/json: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker ...

Try running Visual Studio as admin. Also check if your daemon is running and ready. If you are using docker for windows, and not only the binaries, then there should be a docker icon on the task bar. Also try to give more context in your question, exactly when did this happen?

Related

What is causing airflow webserver to fail and restart on docker for Mac?

I am trying to get Airflow running on a local Docker Desktop for Mac installation using the Quick Start instructions for a Docker installation at https://airflow.apache.org/docs/apache-airflow/stable/start/docker.html. The install seems to go correctly, but when I start up the services using docker-compose up, all the services launch except for the webserver. That service starts, but then fails and restarts, over and over. The log shows this error:
EDIT: I found the issue in case someone else runs into it. The default configuration of Docker desktop for Mac doesn't allocate enough memory to run webserver. I bumped up the memory allocation in Docker, restarted everything, and all was good.
increasing the memory configuration of the docker worked for me
Edit:
Docs for docker configurations on mac: https://docs.docker.com/docker-for-mac/

Unable to install IIS AspNetCoreModuleV2 in a dockerimage (and Azure Pipelines)

I have a problem for few days now with the "dotnet hosting bundle" and AspNetCoreV2 IIS module in a dockerimage.
So, I creating a dockerimage with many IIS modules and requirements to execute our software. The dockerimage works good expect this AspNetCoreV2 module. When the container created, I check the modules installed with Get-WebGlobalModule and doesn't appear.
But, when I start the quiet (or passive) installation manualy, into the container, this module works and appear in the IIS Module list.
I tried many solutions to do that (multistage with aspnetcore Microsoft images, last version of dotnet_hosting_bundle.exe and many other, but same issue).
I tried to automatise the docker exec process to install this module manualy and commit it with Azure Pipelines and Windows agent in a VM, but doesn't work :(.
To try that, I use different way :
docker stop mycontainer
docker rm mycontainer
docker run --name mycontainer -d -it $(containerRegistry)/$(container_requirement_name):v1.0.$(Build.BuildId)
docker exec mycontainer powershell.exe -command Start-Process -FilePath 'C:\Program Files\MySoftware\PowerShell\Installer.Prerequisites\dotnet-hosting-3.1.2-win.exe' -ArgumentList "/passive","/install","/norestart" -PassThru -Wait
docker stop mycontainer
docker commit mycontainer $(containerRegistry)/$(container_requirement_name):v1.0.$(Build.BuildId).1
In the Start-Process, I can see :
The process is created but apparently not started
I also tried with : cmd 'C:\Program Files\MySoftware\PowerShell\Installer.Prerequisites\dotnet-hosting-3.1.2-win.exe' /quiet /install
This task in Azure Pipeline working without error, but when I download this new image (pushed after these instructions), the module doesn't appear in Get-WebGlobalModule
Also, the module is not presend into ProgramFiles
I don't really understand how can I install this module. All other modules working, expect this ...
Thanks you very much in advance for your advises.
Best
Set the preference variables with below command fixed above issue.
powershell -Command $ErrorActionPreference = 'Stop' $ProgressPreference = 'Continue'
The values of the preference variables affect how PowerShell operates and executes cmdLets. It might be because the default settings of the preference variables of the container that caused the PowerShell failing to complete the installation. You can override these preference variables in your script.
Please see this document for more information about Preference Variables.

How do I use Visual Studio 2019 to remotely debug a .NetCore application on a Hyper-V Linux VM?

I am attempting to remotely debug a .NetCore application in Ubuntu Linux from Visual Studio 2019 in Windows 10. I can see the remote ipaddress (ping thru command line). I can RDT to the ipaddress. I can successfully transfer files to it via WinSCP.
I created a simple .NetCore "HelloWorld" app and copied onto the Linux VM.
I used the following commands to build and publish:
dotnet build -r linux-x64
dotnet publish --self-contained -r linux-x64
I ran the following command on the Linux VM to ensure that ssh is functional:
sudo apt-get install openssh-server unzip curl
The app is running on Linux.
From VS I try to attach to the process:
I get prompted for logon:
I get the following error:
Is there a step I'm missing somewhere?
Is there a configuration/permissions issue I am unaware of?
Thanks, JohnB
Microsoft has documented debugging a Linux target from a Windows development machine at https://learn.microsoft.com/en-us/visualstudio/debugger/remote-debugging-dotnet-core-linux-with-ssh?view=vs-2022
Unfortunately, using that method, you will need to manually deploy and manually attach the debugger. If you'd like Microsoft to change that, then it would be wise to upvote this issue: https://developercommunity.visualstudio.com/t/Convenient-way-to-add-a-remote-debug-con/917516
A 3rd party developer has created a Visual Studio extension that provides this missing feature to Visual Studio. It can be downloaded from https://github.com/radutomy/VSRemoteDebugger
I had the same problem initially because I didn't enter the connection target in the first screen.
After having entered the correct target myusername#192.168.178.95 in the first screen the second screen did not show up any longer and I got the expected list of processes

Fail to install Microsoft Cosmos/DocumentDB emulator docker container - unkown blob

enter image description hereI've just installed Docker for Windows on latest Windows 10 Pro. Docker starts and passes the install tests eg docker run hello-world. However, i am unable to successfully download and run the Microsoft DocumentDB emulator. I've followed the instructions:
"Once you have Docker for Windows installed, you can pull the Emulator image from Docker Hub by running the following command from your favorite shell (cmd.exe, PowerShell, etc.)"
docker pull microsoft/azure-documentdb-emulator
From screenshot you can see that the container downloading fails with an "unknown blob" error. Any ideas on how to fix this?
Thanks.
When you run "docker version" in cmd.exe, is the server version Linux/amd64? If so, you need to switch so that the server OS is Windows. To do that, go to the taskbar and right click the docker whale icon, and then click "Switch to Windows containers". You'll then have to restart your machine.

How to deploy asp.net application to docker container on Linux server?

I have installed docker engine on a Linux server. On my desktop's Visual Studio 2015, I created an asp.net application. Now I want to publish it to the Linux server and create a docker image.
I followed this step.
I don't have an azure account and I want to use my own Linux server. So next, I clicked the Docker Containers. The interface became:
Then I clicked Custom Docker Host and pressed OK button.
The interface was
Now I input the image name as DockerDemo. Also I type the server url something like tcp://12.16.45.56:8080. Validate connection is okay then go to the next step.
Finally I get this:
However I get an error during publish.
Severity Code Description Project File Line Suppression State
Error An error occured during publish.
The command [docker -H tcp://12.16.45.56:8080 build -t DockerDemo -f "C:\Users\me\AppData\Local\Temp\PublishTemp\DockerDemo63\approot\src\DockerDemo\Dockerfile" "C:\Users\me\AppData\Local\Temp\PublishTemp\DockerDemo63"] exited with code 1: 'docker' is not recognized as an internal or external command,
operable program or batch file.
Please visit http://go.microsoft.com/fwlink/?LinkID=529706 for troubleshooting guide. DockerDemo 0
By the way, the framework I am using is:
"frameworks": {
"dnx451": { },
"dnxcore50": { }
}
Thanks for help!
Visual Studio can't find the docker command on your local computer. It needs this as a client to connect to the docker daemon on your Linux server. The easiest way to do this is to install Docker Toolbox from here:
https://www.docker.com/products/docker-toolbox
You may have to uninstall and re-install "Visual Studio 2015 Tools for Docker" or manually add to Powershell's $env:Path if the docker command still can't be found.
Also, your Image Name must not contain uppercase characters. Use dockerdemo rather than DockerDemo.

Resources