Project file is in .net 6 32 bit(x86). Here is the sample Dockerfile for HelloWorld
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS runtime
COPY bin/Release/publish .
ENTRYPOINT ["dotnet", "HelloWorldWindows.dll"]
With the above docker file, a simple hello world call is working fine.
for the DCOM client to work I need to run an installer? this installer will register the DCOM interfaces in the registry. How should I run/configure this installer to run, inside a windows container?
Related
I have created a terminal app in C# .NET 6 using Terminal Gui. I have dockerized it
but for some reason every time i run the container it keeps exiting with 139, after looking at the logs it initially mentioned that it was missing libncursew.so.5/6 then i added apk add ncurses but after that now I'm getting that same 139 exit code but no additional detail in the logs.
Has anyone dockerized a Terminal.Gui app?
Thanks in advance
From you question I assumed that you are trying to dockerize Terminal.Gui on an alpine based container (you've mentioned an apk package manager).
Here is an example of dockerizing Terminal.Gui template app on an alpine linux image:
Create a template terminal gui app:
dotnet new --install Terminal.Gui.templates
dotnet new tui -n myproj
cd myproj
dotnet run
Publish it, so we'll be able to use it in a container:
dotnet publish -c Release -r linux-musl-x64 --self-contained
-r stands for run runtime, this is important since we'll be publishing our binaries on another OS, just to keep things working. This is a must for alpine linux, otherwise it won't work.
--self-contained means that we won't need to install dotnet framework on a machine where app will run
Create a dockerfile:
FROM alpine:latest
RUN apk add --no-cache ncurses musl-dev gcc icu bash
WORKDIR /app
COPY ./bin/Release/net6.0/linux-musl-x64/publish/ /app
CMD bash -c /app/myproj
ncurses, musl-dev, gcc, icu and bash are requirements of terminal.gui lib, I found it out via trial and error. Probably part of this is an overkill and you won't need to install full packages, just a little subset of libraries that come with those packages.
published app copied under /app folder in a container.
Build an image:
docker build -t tuiapp .
Create and run container:
docker run --tty --interactive --env TERM tuiapp
--tty this is a terminal gui app, have to instruct docker to assigne a pseudo tty
--interactive otherwise controls won't work
--env TERM have to pass TERM variable of a shell that invokes docker run. If your environment doesn't have TERM env variable set (like in windows terminal for example) you can set it explicitly, like this: ```--env TERM=xterm-256color``, tested it on windows terminal as well.
It should work, tested it on a ubuntu wsl, with tmux and without + tested it on a windows terminal from cmd.
I wrote this small .net core app that backup and transfer mysql database from a server to a dockerized app. However, when I put it in docker and try to run it nothing happens. If there is an error in the app it should console.writeline the error message but nothing.
FROM mysql:5.7.34
COPY ./dbmover /tmp/dbmover
WORKDIR /tmp/dbmover
EXPOSE 3306
As you already figured out my released .net core app is contained in the dbmover folder and copied on the docker container.
Now if I connect to the container shell and execute the app I get no output of it. I run ./myapp.exe
There are my release settings for my app.
Note that this application is not meant to be dockerized it is just a tool to help build the container.
What am I doing wrong ?
SO I didn't noticed at first but I was publishing with visual studio instead of the command line tool. Once it is done publishing it is ginving you the path of the publish. What I ddin't notive is that it was the parent folder of the publishing folder which was linux-x64 folder. Once I took the linux-x64 subfolder instead of the main one it started working.
Does Docker support the standalone (version, xcopy installer) version?
I would like to use docker only to create Windows container images (not run containers) in .NET C# code, and I cannot assume that the machine on which code would be run has docker preinstalled, so having portable version bundled with the code would help.
OS: Windows Server
Edit 2: Docker Client is needed only
Try this link:
https://download.docker.com/win/static/stable/x86_64/
(((((( for 30 chars
Windows requires an emulator to run Linux in order to create a Linux container.
To make it portable, use "Portable-VirtualBox" (administrator privileges required) or "Qemu" (slowly) to run the Linux environment.
I don't think the Windows container creation environment can be made portable.
I am trying to run an asp.net core web application from Dockers container without using Visual Studio but it is not running. I am following the steps listed in this tutorial on Microsoft site.
I have successfully done everything which are:
Creating Image.
Creating and running container with the ASP.NET Core Application.
The Dockers desktop shows that the image and container are both running.
The image (testn) screenshot:
The container (myapp) screenshot:
Now when I open the app url in the browser which is "http://localhost:8080/. I get "This page isn’t working" message. See below image:
My Dockerfile code is:
FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build-env
WORKDIR /app
# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore
# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out
# Build runtime image
FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "Testn.dll"]
I am using Lixus container in Dockers Desktop. My laptop OS is Windows 10 Home.
What I am missing?
Your 8080 port is just exposed, but not published dear.
You should publish your port when you are going to run the container from image like this:
docker run -d -p 8080:8080 testn:latest
I just moved my application to use ASP.Net on .Net Core 3.1. I previously was using NodeJS and Express. I installed the Google Cloud Platform tools for Visual Studio, generated the app.yaml and Dockerfile using the right click menu on my project, modified the app.yaml to what I would assume is a valid configuration, and attempted to publish it. I selected App Engine Flex, selected my project, and I got a "The selected GCP project needs services to be enabled before you can deploy. Enable the services" message. Clicking on Enable the services (which looks like a link) does not do anything. This is preventing be from publishing my app, which is kind of annoying.
Any help would be greatly appreciated :)
app.yaml
service: api
runtime: custom
env: flex
env_variables:
ASPNETCORE_ENVIROMENT: "production"
instance_class: F2
automatic_scaling:
min_idle_instances: 0
max_idle_instances: 2
min_pending_latency: 15ms
max_pending_latency: 100ms
Dockerfile
FROM gcr.io/google-appengine/aspnetcore:3.1
COPY . /app
WORKDIR /app
ENTRYPOINT ["dotnet", "Project Phoenix Game Services.dll"]
Enable the App Engine Admin API.
This happened to me also, when trying to publish a .NET 6 Web API. In order to solve it this is what I did:
Went to my dashboard https://console.cloud.google.com/
Searched for "App Engine Admin API", using the search bar on the top
Enabled it.