VS2022 Docker showing and DockerCompose not available - docker

I've a solution with 2 WEB API items and both have docker support so i can debug them in docker.
I've also had the dockercompose so i could test them like the compose in the running environment. However after a problem with docker desktop and did a reinstall of docker desktop i can't have VS2022 working with docker compose again.
below a part of the log file of visual studio when i load my solution
SetSite failed for package [DockerComposePackage]Source: 'System.ComponentModel.Composition' Description: Cannot cast the underlying exported value of type 'Docker.Compose' to type 'Microsoft.VisualStudio.Containers.Tools.Common.Commands.ICommandManager'.

Related

visual-studio-code : failed to connect. is docker installed?

my environment :
MacOS M1 chip
VSCode version 1.66.2 arm64
local installed docker version : 20.10.22
I have situations that docker is not working in VSCode.
I already installed docker in local. But when I'm trying to connect docker in VSCode, repeatedly asking install docker extensions. (but I do have docker already ). and if I do reinstall with following the VSCode, the docker version was broken (changed to intel chip docker).
Does anybody know what's wrong?
Docker Extensions for VS Code have nothing to do with the Docker engine itself. They are like an additional layer of tools and commands over the installed Docker. E.g. they provide IntelliSense for editing Docker-related files, you can run Docker commands from F1 drop-down, etc. But you should be able to do all the required tasks even without Docker Extensions, e.g. from the Terminal in VS Code, but for this the path to Docker CLI (command line interface) should be added to PATH environment variable.
If you are getting failed to connect error then maybe Docker engine is not running. Please refer to https://docs.docker.com/desktop/install/mac-install/ and https://docs.docker.com/desktop/troubleshoot/overview/ about how to check if the engine is running and how to troubleshoot the issues.
If that doesn't help, please provide some specific error and steps, which led to it, then we'll try to find out.

Getting error when I try to run a docker image on aws fargate windows 2019 full created on Windows 10 20h2

I have Windows Docker Desktop, my os is Windows 10 enterprise , version 20h2
Docker for windows working... i have a small mvc asp.net3.1 application.
I create my docker image and i am able to run the container locally.
Everything is working from my local.
Now i uploaded the image to AWS ECR, create my taskDef and service.
Unfortunatelly the task does not start with the error :
failed to create new container runtime task: failed to create shim: hcs::CreateComputeSystem 95cade147ae4418ab3d68ea1a2c70800-2341308736: The container operating system does not match the host operat
I have seen some compatibility list from microsoft on the OS https://learn.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/version-compatibility?tabs=windows-server-2022%2Cwindows-11-21H2
I check i have hyperv and all..
Does anyone know how i can make the image compatible? This seems to be a known issues, but i am kind of blocked here.
Thanks
The error indicates you have a different image version versus the host version. What is the base image on your dockerfile? And do you know what is the host version on your AWS environment? For reference, here's the documentation on host compatibility: https://learn.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/version-compatibility?tabs=windows-server-2022%2Cwindows-11-21H2

Autoload/PHPUnit not found by PhpStorm with Docker Desktop + Docker Compose + WSL

My PHP project is stored in WSL, accessed by PhpStorm installed on Windows and running with Docker Desktop installed on Windows.
The Project itself is totally fine, but running Tests is not possible because PhpStorm cannot find the vendor autoload or phpunit.phar in Test Framework configuration.
Setup:
Windows 10 with WSL2 Ubuntu 20.04 LTS
PhpStorm on Windows
Docker Desktop on Windows, Docker Compose files in WSL
Code in home folder in WSL (see following screens)
I read in some older threads that Docker Compose v2 needs to be enabled in Docker Desktop. It is:
Docker is configured inside of PhpStorm and shows that the connection is successful (I know that works because things like Xdebug is working without any issues):
Notice that I configured a path mapping here for the project root.
in WSL: \\wsl$\Ubuntu\home\USERNAME\workspace\PROJECTNAME-web-docker
in Docker: /var/www/PROJECTNAME-web
I can see that those paths are correct by either logging into the Docker container or by checking the Service Tab of PhpStorm and inspecting files:
This is my CLI Interpreter using the docker-compose configuration:
It does not matter if I use the existing container or if it should be starting a new one
PHP Version is always detected
And finally the error inside of Test Framework:
Here I tried different things:
use composer autoloader or phpunit.phar
it doesn't matter if I use a full path /var/www... or just vendor/...
tried different path mappings here
clicking on refresh shows this error in a small popup
Cannot parse PHPUnit version output: Could not open input file: /var/www/PROJECTNAME-web/SUBTOPIC/vendor/phpunit/phpunit/phpunit
autoload.php is definitely available and correct, phpunit is installed and available.
Maybe someone has a hint what is missing or wrong? Thanks!
EDIT:
How do I know that autoload is available or path mapping is correct?
I have Xdebug configured and running. When Xdebug stops in my code, I know that the path mapping is correct. The output of Debug -> Console for example shows stuff like this:
PHP Deprecated: YAML mapping driver is deprecated and will be removed in Doctrine ORM 3.0, please migrate to annotation or XML driver. in /var/www/PROJECTNAME-web/SUBTOPIC/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php on line 62
so I know the path mapping for xdebug works, but seems like Test Framework config does not like it.

Remote-Containers Extension of VS Code not able to execute docker commands

Setup:
Ubuntu 20.04 distro running inside WSL2 (5.4.72-microsoft-standard-WSL2)
VS Code version 1.55.2 installed in Windows
Docker version 19.03.8, build afacb8b7f0 installed in WSL2
docker-compose version 1.29.0, build 07737305 installed in WSL2
Remote-Containers Extension for VS Code v0.166.1 installed locally (I could not find an option to explicitly install this inside WSL2, but I am not sure if this even matters, see below)
Original error:
When I open the command palette and enter Remote-Containers: Rebuild and Reopen in Container, I get the error `The 'docker' command was not found. Make sure Docker is installed' in a pop up window.
What I tried:
Attempt 1
First, I thought that the Remote-Containers extension wants to execute the docker commands inside windows and not WSL2. Since I don't have Docker Desktop installed on Windows, it is impossible to execute docker commands in Windows. So I tried downloading a specific version of the the Remote-Containers extension file from the marketplace v0.165.0 I believe, copying it into the VS extension folder inside WSL2 /home/kevinsuedmersen/.vscode-server/extensions and installing it manually from the VS Code Extension panel. However, this also installed the Remote-Containers extension locally, so probably on Windows. I am not sure if locally means that this extension is available globally, but nevertheless, I am still getting the error that the docker command is not found as explained above.
Attempt 2
I notice that when I open a PowerShell on Windows, I can use the docker daemon inside WSL2 by prepending wsl to all docker commands, e.g. wsl docker run hello-world. So, I went to the VS Code and in settings (Settings > Remote > Containers > Docker Path), I changed the docker path from docker to wsl docker, but then, I got this error Docker Desktop WSL 2 backend required. This is even the case on another laptop, where I actually have Docker Desktop installed and the WSL2 backend enabled.
Attempt 3
I tried changing the docker path in VS code to the full path of the docker socket in WSL2 /var/run/docker.sock, but then I got the error Current user does not have permission to run 'docker'. Try adding the user to the 'docker' group. My current user kevinsuedmersen is already member of the docker group.
Any advice or directions are greatly appreciated.
Answer was given on the GitHub Repo of the VS-Remote-Container Extension here: https://github.com/microsoft/vscode-remote-release/issues/4914

IBM cloud : Cannot build app

I am working on a windows 10 home so I have a docker toolbox and am using an IBM cloud app service : python-django app. I followed all the instructions given here:
https://console.bluemix.net/docs/apps/tutorials/tutorial_web.html#before-you-begin
I then open it in Pycharm (community edn) and try to build it locally by doing the following :
1)Import the settings.jar file (Given in the developer tools)
2)Tools > IBM Cloud Developer Tools > Build app in release mode
But I get the following error :
Creating image latestpy-django-tools based on Dockerfile-tools...
Building...
OK
Creating a container named 'latestpy-django-tools' from that image...
FAILED
An error Error response from daemon: invalid mode: /app was encountered while creating Docker container 'latestpy-django-tools'.
Please help!!
Kiera.k, on your Win10 system do you have Docker Toolbox or Docker for Windows? IBM Cloud Developer Tools requires Docker for Windows and will not work with Docker Toolbox.
Also, running build with the additional --trace parameter might provide some more details, if you have not already been using that. If you are using Docker for Windows, seeing all the output you get with --trace would be great.

Resources