My objective is to have a development environment with docker and Kubernetes integrated with Visual Studio 2017 so that I can run the app on the docker container from directly within Visual Studio. I'm on a Windows 7 OS.
My research has taken me thus far:
- Docker for Windows only supports Windows 10+. As an alternative, I can use Docker Toolbox which setups a Virtual Machine via Virtual Box and runs a Linux VM (boot2docker). Docker actually runs in this Linux VM and shares its executable with Windows 7 via environment variables.
- Kitematic comes with Docker Toolbox and is essentially a GUI tool for managing my docker images.
Here are the questions, I'm trying to get answered and the issues I'm experiencing:
- When I launch Kitematic, it says "Couldn't find a native setup" for docker. When I try to install Docker for Windows, clicking on the executable does nothing. Is it impossible to install Docker natively on Windows 7 without a Virtual Machine in the middle?
- In using the Boot2Docker VM, it is a Linux distro and consequently, I can only use .NET core and ASP.NET core. If I can't get a native Docker instance, is it possible to have a Boot2Docker Windows machine so I can utilize all of the .NET framework on it?
- I was finally able to build and run the docker image from Git Bash utilizing the Boot2Docker docker machine, but when I try to integrate with Visual Studio I get this error:
C:\Users\JoeTest\.nuget\packages\microsoft.visualstudio.azure.containers.tools.targets\1.0.1916590\build\Container.targets(222,5): error CTC1003: Visual Studio container tools require Docker to be running.
I've found various solutions that range from PowerShell to ensuring the C:/Users/ folder was shared between the Virtual Box image and Windows 7 host, but nothing seems to work for the VS Studio integration. Here are the steps to reproduce:
- Created project in Visual Studio 2017 for ASP.NET core on Windows 7
- Installed and Validated Docker Toolbox, e.g. can execute docker run hello-world
Closed the project in VS Studio and setup the following in Powershell:
docker-machine env $Env:DOCKER_TLS_VERIFY = "1" $Env:DOCKER_HOST = "tcp://192.168.99.100:2376" $Env:DOCKER_CERT_PATH = "C\Users\JoeTest\.docker\machine\machines\default" $Env:DOCKER_MACHINE_NAME = "default" $Env:COMPOSE_CONVERT_WINDOWS_PATHS = "true" /# Run this command to configure your shell: /# & "C:\Program Files\Docker Toolbox\docker-machine.exe" env | Invoke-Expression PS C:\Users\JoeTest> & "C:\Program Files\Docker Toolbox\docker-machine.exe" env | Invoke-Expression
invoke-item C:\Users\JoeTest\source\repos\VSEWebAppSample\VSEWebAppSample.sln
This opens the Visual Studio Project. 4. Then, I type Ctrl + F5 and get the following output:
1>------ Build started: Project: VSEWebAppSample, Configuration: Debug Any CPU ------
1>VSEWebAppSample -> C:\Users\JoeTest\source\repos\VSEWebAppSample\VSEWebAppSample\bin\Debug\netcoreapp2.1\VSEWebAppSample.dll
1>VSEWebAppSample -> C:\Users\JoeTest\source\repos\VSEWebAppSample\VSEWebAppSample\bin\Debug\netcoreapp2.1\VSEWebAppSample.Views.dll
1>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NonInteractive -NoProfile -WindowStyle Hidden -ExecutionPolicy RemoteSigned -File "C:\Users\JoeTest\AppData\Local\Temp\GetVsDbg.ps1" -Version vs2017u5 -RuntimeID debian.8-x64 -InstallPath "C:\Users\JoeTest\vsdbg\vs2017u5"
1>Info: Using vsdbg version '15.7.20425.2'
1>Info: Using Runtime ID 'linux-x64'
1>Info: C:\Users\JoeTest\vsdbg\vs2017u5 exists, deleting.
1>Add-Type : Cannot add type. The assembly 'System.IO.Compression.FileSystem' cou
1>ld not be found.
1>At C:\Users\JoeTest\AppData\Local\Temp\GetVsDbg.ps1:47 char:13
1>+ Add-Type <<<< -assembly "System.IO.Compression.FileSystem"
1> + CategoryInfo : ObjectNotFound: (System.IO.Compression.FileSyste
1> m:String) [Add-Type], Exception
1> + FullyQualifiedErrorId : ASSEMBLY_NOT_FOUND,Microsoft.PowerShell.Commands
1> .AddTypeCommand
1>
1>Add-Type : Cannot add type. One or more required assemblies are missing.
1>At C:\Users\JoeTest\AppData\Local\Temp\GetVsDbg.ps1:47 char:13
1>+ Add-Type <<<< -assembly "System.IO.Compression.FileSystem"
1> + CategoryInfo : InvalidData: (:) [Add-Type], InvalidOperationExc
1> eption
1> + FullyQualifiedErrorId : ASSEMBLY_LOAD_ERRORS,Microsoft.PowerShell.Comman
1> ds.AddTypeCommand
1>
1>Add-Type : Cannot add type. The assembly 'System.IO.Compression' could not be f
1>ound.
1>At C:\Users\JoeTest\AppData\Local\Temp\GetVsDbg.ps1:48 char:13
1>+ Add-Type <<<< -assembly "System.IO.Compression"
1> + CategoryInfo : ObjectNotFound: (System.IO.Compression:String) [
1> Add-Type], Exception
1> + FullyQualifiedErrorId : ASSEMBLY_NOT_FOUND,Microsoft.PowerShell.Commands
1> .AddTypeCommand
1>
1>Add-Type : Cannot add type. One or more required assemblies are missing.
1>At C:\Users\JoeTest\AppData\Local\Temp\GetVsDbg.ps1:48 char:13
1>+ Add-Type <<<< -assembly "System.IO.Compression"
1> + CategoryInfo : InvalidData: (:) [Add-Type], InvalidOperationExc
1> eption
1> + FullyQualifiedErrorId : ASSEMBLY_LOAD_ERRORS,Microsoft.PowerShell.Comman
1> ds.AddTypeCommand
1>
1>New-Object : Cannot find type [System.IO.Compression.ZipArchive]: make sure the
1> assembly containing this type is loaded.
1>At C:\Users\JoeTest\AppData\Local\Temp\GetVsDbg.ps1:64 char:29
1>+ $zipArchive = New-Object <<<< System.IO.Compression.ZipArchive -Argument
1>List $zipStream
1> + CategoryInfo : InvalidType: (:) [New-Object], PSArgumentExcepti
1> on
1> + FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewOb
1> jectCommand
1>
1>Unable to find type [System.IO.Compression.ZipFileExtensions]: make sure that t
1>he assembly containing this type is loaded.
1>At C:\Users\JoeTest\AppData\Local\Temp\GetVsDbg.ps1:65 char:46
1>+ [System.IO.Compression.ZipFileExtensions] <<<< ::ExtractToDirectory($zipA
1>rchive, $targetLocation)
1> + CategoryInfo : InvalidOperation: (System.IO.Compression.ZipFile
1> Extensions:String) [], RuntimeException
1> + FullyQualifiedErrorId : TypeNotFound
1>
1>You cannot call a method on a null-valued expression.
1>At C:\Users\JoeTest\AppData\Local\Temp\GetVsDbg.ps1:66 char:24
1>+ $zipArchive.Dispose <<<< ()
1> + CategoryInfo : InvalidOperation: (Dispose:String) [], RuntimeEx
1> ception
1> + FullyQualifiedErrorId : InvokeMethodOnNull
1>
1>Out-File : Could not find a part of the path 'C:\Users\JoeTest\vsdbg\vs2017u5\s
1>uccess_rid.txt'.
1>At C:\Users\JoeTest\AppData\Local\Temp\GetVsDbg.ps1:97 char:26
1>+ $runtimeId | Out-File <<<< -Encoding utf8 $SuccessRidFile
1> + CategoryInfo : OpenError: (:) [Out-File], DirectoryNotFoundExce
1> ption
1> + FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.Ou
1> tFileCommand
1>
1>Out-File : Could not find a part of the path 'C:\Users\JoeTest\vsdbg\vs2017u5\s
1>uccess_version.txt'.
1>At C:\Users\JoeTest\AppData\Local\Temp\GetVsDbg.ps1:100 char:24
1>+ $version | Out-File <<<< -Encoding utf8 $SuccessVersionFile
1> + CategoryInfo : OpenError: (:) [Out-File], DirectoryNotFoundExce
1> ption
1> + FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.Ou
1> tFileCommand
1>
1>Info: Successfully installed vsdbg at 'C:\Users\JoeTest\vsdbg\vs2017u5'
1>docker build -f "C:\Users\JoeTest\source\repos\VSEWebAppSample\VSEWebAppSample\Dockerfile" -t vsewebappsample:dev --target base "C:\Users\JoeTest\source\repos\VSEWebAppSample"
1>Sending build context to Docker daemon 2.471MB
1>
1>Step 1/4 : FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
1> ---> 40d759655ea3
1>Step 2/4 : WORKDIR /app
1> ---> Using cache
1> ---> f82084d08a44
1>Step 3/4 : EXPOSE 49718
1> ---> Using cache
1> ---> 22d65a07b772
1>Step 4/4 : EXPOSE 44315
1> ---> Using cache
1> ---> 1a6aecd0e9f1
1>Successfully built 1a6aecd0e9f1
1>Successfully tagged vsewebappsample:dev
1> C:\Users\JoeTest\.nuget\packages\microsoft.visualstudio.azure.containers.tools.targets\1.0.1916590\build\Container.targets(222,5): error CTC1003: Visual Studio container tools require Docker to be running.
One article I found said I needed to update my PowerShell version but I went to this link and was confused which option I should download. Any help is much appreciated.