install .net framework 4.7.2 in docker - asp.net

I'm new to .Net Environment, I'm trying to implement docker here for my firm. They were using 4.5 earlier so I used the following statement in my dockerfile:
RUN Install-WindowsFeature NET-Framework-45-ASPNET ; \
Install-WindowsFeature Web-Asp-Net45
Now, I want to do the same for framework 4.7.2 - I thought it will work if I run the statements like :
RUN Install-WindowsFeature NET-Framework-472-ASPNET ; \
Install-WindowsFeature Web-Asp-Net472
But it's not working this way instead shows the following error :
Install-WindowsFeature : ArgumentNotValid: The role, role service, or feature
name is not valid: 'NET-Framework-472-ASPNET'. The name was not found.
At line:1 char:1
+ Install-WindowsFeature NET-Framework-472-ASPNET ; Install-WindowsFeat ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (NET-Framework-472-ASPNET:Strin
g) [Install-WindowsFeature], Exception
+ FullyQualifiedErrorId : NameDoesNotExist,Microsoft.Windows.ServerManager
.Commands.AddWindowsFeatureCommand
Please help me with the same. I am really stuck and can't find anything on the internet.

Instead of Installing the NET-Framework yourself, you could use
FROM microsoft/aspnet
or
FROM microsoft/dotnet-framework:4.7.2
to use an image with dotnet framework already installed.
or whatever version you need.
See https://hub.docker.com/u/microsoft/
for all the images on docker hub

So i searched for a few things online and i found out that there is one solution that if i mention to install chocolatey on powershell inside my docker file. This reference, I have received from the this post by anothony chu:
so i used:
# Install Chocolatey
RUN #powershell -NoProfile -ExecutionPolicy Bypass -Command "$env:ChocolateyUseWindowsCompression='false'; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
RUN powershell add-windowsfeature web-asp-net45 \
&& choco install dotnet4.7 --allow-empty-checksums -y \
in my docker file and now all works fine and good.

Related

/opt/cmake/bin/cmake no file in the directory

I am installing Qt6 using this guide on my fresh raspberry pi 4 running the latest official 32bit OS
https://www.tal.org/tutorials/building-qt-62-raspberry-pi
and i am stuck in the Configure the Qt 6.2 build portion where it asks me to execute this line
/opt/cmake/bin/cmake -G Ninja \
-DCMAKE_INSTALL_PREFIX=/opt/Qt/6.2.3-armv7l \
-DQT_FEATURE_opengles2=ON \
-DQT_FEATURE_opengles3=ON \
-DCMAKE_TOOLCHAIN_FILE=tc.cmake \
-DQT_AVOID_CMAKE_ARCHIVING_API=ON ../qtbase-everywhere-src-6.2.3
but i am getting an error
bash: /opt/cmake/bin/cmake: No such file or directory
I followed every step behore hand and there were no problems, everthing went smoothly exempt this part. Can anybody help me with this problem ?
If you have installed Cmake through apt, the default path should be
/usr/bin/cmake
Try to see if is there. If yes, you might want to replace
/opt/cmake/bin/cmake
with
/usr/bin/cmake
Another way to find if you have cmake installed somewhere else would be to run the command:
whereis cmake

How to use dotnet core on docker dotnet framework image

As per title, I want to use dotnet core on dotnet framework aspnet image. A little bit of background, I have ASP.NET (4.6) application with dotnet core libraries. Currently it is running on IIS. Now, I'm looking forward to dockerize this by using windows server core image. No particular reason, just looking to dockerize and modernize legacy application.
I'm started with this image: mcr.microsoft.com/dotnet/framework/sdk
And I'm using this image as runtime: mcr.microsoft.com/dotnet/framework/aspnet
Problem is during runtime, the IIS inside aspnet doesn't recognize aspnetmodule. In IIS we normally install hosting bundle, how to do this on docker?
Thank you
Just for record keeping, am sharing this. What I did was I take the images from Microsoft and add installation for Hosting bundle. In this case, I'm using dotnet core 1.1:
# escape=`
ARG REPO=mcr.microsoft.com/dotnet/framework/runtime
FROM $REPO:4.8-windowsservercore-ltsc2019
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ADD dotnetcore.1.0.16_1.1.13-windowshosting.exe /install/
RUN Add-WindowsFeature Web-Server; `
Add-WindowsFeature NET-Framework-45-ASPNET; `
Add-WindowsFeature Web-Asp-Net45; `
Remove-Item -Recurse C:\inetpub\wwwroot\*; `
Invoke-WebRequest -Uri https://dotnetbinaries.blob.core.windows.net/servicemonitor/2.0.1.6/ServiceMonitor.exe -OutFile C:\ServiceMonitor.exe
# Install Roslyn compilers and ngen binaries
RUN Invoke-WebRequest https://api.nuget.org/packages/microsoft.net.compilers.2.9.0.nupkg -OutFile c:\microsoft.net.compilers.2.9.0.zip; `
Expand-Archive -Path c:\microsoft.net.compilers.2.9.0.zip -DestinationPath c:\RoslynCompilers; `
Remove-Item c:\microsoft.net.compilers.2.9.0.zip -Force; `
&C:\install\dotnetcore.1.0.16_1.1.13-windowshosting.exe /install /quiet | `
&C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ngen.exe install c:\RoslynCompilers\tools\csc.exe /ExeConfig:c:\RoslynCompilers\tools\csc.exe | `
&C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ngen.exe install c:\RoslynCompilers\tools\vbc.exe /ExeConfig:c:\RoslynCompilers\tools\vbc.exe | `
&C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ngen.exe install c:\RoslynCompilers\tools\VBCSCompiler.exe /ExeConfig:c:\RoslynCompilers\tools\VBCSCompiler.exe | `
&C:\Windows\Microsoft.NET\Framework\v4.0.30319\ngen.exe install c:\RoslynCompilers\tools\csc.exe /ExeConfig:c:\RoslynCompilers\tools\csc.exe | `
&C:\Windows\Microsoft.NET\Framework\v4.0.30319\ngen.exe install c:\RoslynCompilers\tools\vbc.exe /ExeConfig:c:\RoslynCompilers\tools\vbc.exe | `
&C:\Windows\Microsoft.NET\Framework\v4.0.30319\ngen.exe install c:\RoslynCompilers\tools\VBCSCompiler.exe /ExeConfig:c:\RoslynCompilers\tools\VBCSCompiler.exe
ENV ROSLYN_COMPILER_LOCATION c:\\RoslynCompilers\\tools
EXPOSE 80
ENTRYPOINT ["C:\\ServiceMonitor.exe", "w3svc"]
I have no way to automate download for hosting bundle. You may need to download it from microsoft site: https://dotnet.microsoft.com/download/dotnet-core/2.2, choose runtime and hosting bundle.
Put it together with the Dockerfile so Docker can copy it into the image. This image can run on Windows Server 2019. For other version of Windows Server, you may need to use different tag.
P/S: Hosting bundle installation is a bit tricky, I used to extend the
image but somehow the installation become ephemeral and lost. This is
working for me, hope this helps.
Find download link of the .NET Core SDK you need here https://dotnet.microsoft.com/download/dotnet-core.
Here is sample for .NET Core 2.2
FROM mcr.microsoft.com/dotnet/framework/runtime:4.7.2 AS runtime
# Replace download URL with .NET Core SDK you need.
ADD https://download.visualstudio.microsoft.com/download/pr/7ae62589-2bc1-412d-a653-5336cff54194/b573c4b135280fb369e671a8f477163a/dotnet-sdk-2.2.100-win-x64.exe c:/setup
RUN C:/setup/dotnet-sdk-2.2.100-win-x64.exe /install /quiet
ENTRYPOINT ["dotnet", "YOUR_NET_CORE_DLL_NAME.dll"]

robot command not found if installing robotframework with pip --user

I am getting an error when execute robot scripts through CMD (windows)
'robot' is not recognized as an internal or external command, operable
program or batch file"
My team installed Python in C:\Python27 folder and I installed ROBOT framework and all required libraries with the following command
"python -m pip install -U setuptools --user, python -m pip install -U robotframework --user"
We are not authorized to install anything in C drive and all libraries were installed successfully. But when I try to execute the scripts through CMD then getting error.
Note:
All Robot Libaries are installed in "C:\Users\bab\AppData\Roaming\Python\Python27\site-packages"
I did set up the Env variables with above path
Scripts are working through ECLIPSE and using the command below
Command
C:\Python27\python.exe -m robot.run --listener C:\Users\bab\AppData \Local\Temp\RobotTempDir2497069958731862237\TestRunnerAgent.py:61106 --argumentfile C:\Users\bab\AppData\Local\Temp\RobotTempDir2497069958731862237\args_c4fe2372.arg C:\Users\bab\Robot_Sframe\E2Automation
Please help me, as this step is very key to integrate my scripts with Jenkins
Thanks a lot, it works for me. Just write the following in the terminal:
python -m robot "your file name"
In this case the file name is TC1.robot, so the command would be:
python -m robot TC1.robot
I was getting an error when executing robot scripts through linux command of
sudo pip install robotframework
and the below command worked for me:
sudo pip3 install robotframework
I've installed robotframework using this command "sudo pip3 install robotframework" in jenkins server. and now my jenkins pipeline script can now run my robot scripts
I'm not very comfort with Windows environment, so let me give my two cents:
1) Try to set the PATH or PYTHONPATH to the location where your robot file is
2) Try to run robot from python script. I saw that you tried it above, but take a look at the RF User Guide and see if you are doing something wrong:
https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#using-robot-and-rebot-scripts
maybe just
python -m robot ....
is fine
Thanks, It worked , first I cd to the Site packeges where Robot is installed and ran with Python -m command cd Users\babo\AppData\Roaming\Python\Python27\site-packages\robot>C:\Python27\python.exe -m robot.run -d Results C:\Users\bab\Robot_Sframe\E2EAutomation\Test_Suite\Enrollment_834.robo
We can close this

Qt non-interactive install in Docker file fails with QXcbConnection DISPLAY Error

I am running a Docker file that does a non-interactive installation. The installation fails with a DISPLAY error. I can confirm that the non-interactive install works on a Ubuntu 14.04 VM with a display. I'm trying to install on a development server without a display.
Here is the output:
Step 15/21 : ENV QT_VERSION_A=5.8
---> Using cache
---> 585508f8fb4e
Step 16/21 : ENV QT_VERSION_B=5.8.0
---> Using cache
---> 32eb654acb19
Step 17/21 : ENV QT_VERSION_SCRIPT=580
---> Using cache
---> 7be314d66824
Step 18/21 : RUN wget https://download.qt.io/archive/qt/${QT_VERSION_A}/${QT_VERSION_B}/qt-opensource-linux-x64-${QT_VERSION_B}.run
---> Using cache
---> b16f68a4774e
Step 19/21 : RUN chmod +x qt-opensource-linux-x64-${QT_VERSION_B}.run
---> Using cache
---> dcd41dd5c287
Step 20/21 : COPY qt-noninteractive.qs /qt-noninteractive.qs
---> Using cache
---> 72c46b2abe23
Step 21/21 : RUN ./qt-opensource-linux-x64-${QT_VERSION_B}.run --script qt-noninteractive.qs
---> Running in e75d96617513
QXcbConnection: Could not connect to display
Aborted (core dumped)
Is there an option I can give where it doesn't need a display?
I tried going the non-GUI install apt-get method on Ubuntu to install Qt but the problem is 'apt-get qt5-default' does not contain Qt5 WebEngine which I require. Any help would be appreciated.
Here's the Docker File Qt install snippet:
ENV QT_VERSION_A=5.8
ENV QT_VERSION_B=5.8.0
ENV QT_VERSION_SCRIPT=580
RUN wget https://download.qt.io/archive/qt/${QT_VERSION_A}/${QT_VERSION_B}/qt-opensource-linux-x64-${QT_VERSION_B}.run
RUN chmod +x qt-opensource-linux-x64-${QT_VERSION_B}.run
COPY qt-noninteractive.qs /qt-noninteractive.qs
RUN ./qt-opensource-linux-x64-${QT_VERSION_B}.run --script qt-noninteractive.qs
I tried going the non-GUI install apt-get method on Ubuntu to install Qt but the problem is 'apt-get qt5-default' does not contain Qt5 WebEngine which I require
You could (additionally to the apt-get qt5-default) install the package which does contain it. If you check https://packages.ubuntu.com/search?keywords=web+engine there are the packets. Maybe libqt5webengine5 or libqt5webenginewidgets5. So your command would then be:
apt-get qt5-default libqt5webengine5
First, ensure you have the silent option enabled in your .qs controller
function Controller() {
gui.setSilent(true);
Then, use the --platform minimal option when calling the Qt Installer.
RUN ./qt-opensource-linux-x64-${QT_VERSION_B}.run --platform minimal --script qt-noninteractive.qs

Unable to build Dockerfile Error: Unable to access jarfile /dev/docker-files/billing/wlp-extended-8.5.5.9.jar

here's the directory of my ubuntu.
/../../../
BillingMicroservice.war
db-derby-10.11.1.1-bin.tar.gz
Dockerfile
wlp-extended-8.5.5.9.jar
wlp-runtime-8.5.5.9.jar
and here's my Dockerfile
FROM ubuntu
ADD wlp-extended-8.5.5.9.jar /dev/root/
ADD wlp-runtime-8.5.5.9.jar /dev/root/
ADD BillingMicroservice.war /dev/root/
ADD db-derby-10.11.1.1-bin.tar.gz /dev/root/
RUN apt-get update
RUN apt-get install -y default-jre
RUN java -jar /dev/docker-files/billing/wlp-runtime-8.5.5.9.jar --acceptLicense /dev/docker-files/billing/
RUN java -jar /dev/docker-files/billing/wlp-extended-8.5.5.9.jar --acceptLicense /dev/docker-files/billing/
EXPOSE 9080
when i try to execute the following command in my ubuntu:
docker build -t xxxxxx/billing . and it will log the error
Error: Unable to access jarfile /dev/docker-files/billing/wlp-extended-8.5.5.9.jar
please help me with this, thnx.
The RUN instruction is running inside the container, and according to your Dockerfile;
ADD wlp-extended-8.5.5.9.jar /dev/root/
You added that file inside /dev/root/ inside your image. I think those two RUN instructions should be:
RUN java -jar /dev/root/wlp-runtime-8.5.5.9.jar --acceptLicense /dev/root/
RUN java -jar /dev/root/wlp-extended-8.5.5.9.jar --acceptLicense /dev/root/

Resources