How to build .net core application for debian:jessie - linux

I have created a sample application using .net core. I need to build the application for debian:jessie os. I have following commands
dotnet restore MySampleApp.sln -r -debian:jessie-x64
dotnet build MySampleApp.csproj --verbosity q -c Release -r -debian:jessie-x64
But it shows error message like this
error : NETSDK1056: Project is targeting runtime '-debian:jessie-x64' but did not resolve any runtime-specific packages. This runtime may not be supported by the target framework.
But I can run the same application using alpine Linux without any error
dotnet restore MySampleApp.sln -r alpine.3.7-x64
dotnet build MySampleApp.csproj --verbosity q -c Release -r alpine.3.7-x64

The team has provided a complete list for Runtime IDentifiers on GitHub.
Indeed, there's a RID of alpine.3.7-x64 defined in line30. But as you can see between the line129 and Line233, there's no such a RID whose name is debian:jessie-x64.
You need to use debian.8-x64 instead.

Related

Golang + Linux + Docker error : standard_init_linux.go:211 : no such file or directory

This is not a duplicate because although the error is same, my use case is different from others.
I am compiling a go application to deploy with docker on:
latest arch linux
latest docker version, golang:alpine image
tried with go version 1.13.3 and 1.14.4 linux amd64
i have no bash scripts or wrong file endings. Whole project is written on this Linux machine
i can deploy an empty go app that has only a fmt print without any error
however,
when i build it on my OSX machine, and send it to linux, I can deploy that executable to docker without any error
OSX mojave
latest docker
go 1.13.3
GOOS=linux
Error :
standard_init_linux.go:211: exec user process caused "no such file or directory"
When you compile your go app with cgo enabled the compiler links dynamically to libstdc .
However, golang:alpine image is so small, because it is not using libstdc but a simplified version of it called musl libc.
The error message says
standard_init_linux.go:211: exec user process caused "no such file or directory"
If you connect to your image with
$ docker run -it [image] /bin/sh
you can find your executable in let's say /dist/myexec, but when you try to run that executable, it says err not found, because of not that it can't find your executable, obviously, but it can't find file libc .
The solution is to either
disable CGO : use CGO_ENABLED=0 while building
or add
RUN apk add --no-cache libc6-compat
to your Dockerfile
or do not use golang:alpine
To have a all static binary executable, build it with:
$ CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' .

Get the command that Visual Studio uses to build the container

I did a basic Web API .NET Core project in Visual Studio 2019. I selected to run in a Linux Container.
When you build and run, it creates the container from the docker file that is created.
I would like to see the command it uses to create the container. I know it will be something like this:
docker image build --tag mysolution:dev --file .\Dockerfile .
But I would like to see what the actual command is.
I tried looking through the build output and the Container Tools output, but I could not find this command logged in there anywhere.
Is there a way to see what command is used to build the container?
You can use Process Monitor to record and explore what arguments were used to start a process.
If you have "MSBuild project build output verbosity" set to at least Minimal (Under Tools -> Options -> Projects and Solutions -> Build and Run), then you should be able to see all the Docker commands that Visual Studio executes in the output window.
It would be in "Container Tools" or "Build" output window.

Error: C:\Program Files\Docker\docker.exe: failed to register layer: re-exec error: exit status 1: output: ProcessUtilityVMImage

Steps to reproduce the problem
Step 1. Create a .NET Core 2.0 console app for Dockerization
d:\Hello> dotnet new console
Step 2. Add a new file dockerfile to the folder d:\Hello:
FROM microsoft/dotnet
WORKDIR /app
copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore
copy and build everything else
COPY . ./
RUN dotnet publish -c Release -o out
ENTRYPOINT ["dotnet", "out/Hello.dll"]
Step 3: Push the Docker Image to repository.
d:\Hello> docker image push sandeepsoni/demo
Step 4: Created a New VM in Windows Azure (Windows Server 2016 with Container)
Step 5: From the VM executing the following command
c:> docker run sandeepsoni\demo
It's downloading the files and after extracting giving the following error:
C:\Program Files\Docker\docker.exe: failed to register layer: re-exec error: exit status 1: output: ProcessUtilityVMImage C:\ProgramData\docker\windowsfilter\67d5b7d6c870c7ec84a26def53bb3882da856a2e55f2f94e52d651293f4e3547\UtilityVM: The system cannot find the path specified.
Can you please help with the error and solution.
Thanks.
I've seen such error when I tried to run my Docker images built for Windows Server 1709 (newer and smaller images) on Windows Server 2016 host. MS introduced major breaking change for their base images. You cannot run images built for Windows 1709 on Windows Server 2016 (long-term support channel) unless you use hyperv isolation.
Try to switch base image from
FROM microsoft/dotnet
to
FROM microsoft/dotnet:2.0-sdk-nanoserver-sac2016

Deploying Haskell (standalone, yesod, snap...) in Openshift fails

Whenever I try to create an application based on the Haskell cartridge, it results in the a variant of the following error:
The initial build for the application failed: Shell command '/sbin/runuser -s /bin/sh 55c67c940c1e6694ac000017 -c "exec /usr/bin/runcon 'unconfined_u:system_r:openshift_t:s0:c5,c753' /bin/sh -c \"gear postreceive --init >> /tmp/initial-build.log 2>&1\""' returned an error. rc=137 .Last 10 kB of build output: The server is not running, nothing to stop. Repairing links for 1 deployments Building git ref 'master', commit 6b8beb4 Downloading the latest package list from hackage.haskell.org
This happens for predefined cartridges in the Openshift hub, such as Snap, Yesod, Scotty, and for the cartridges defined in the wiki (https://wiki.haskell.org/Web/Cloud).
I'm requesting help because he application never gets created thus I can't check the logs, and I can't make much from the error message. I tried other cartridge types than Haskell, and they get created just fine.
This is caused by https://github.com/haskell/cabal/issues/2396, see https://wiki.haskell.org/Web/Cloud#OpenShift. May be fixed in cabal-install 1.24.

How to install InfluxDB in Windows

I am new to InfluxDB. I could not find any details about installing InfluxDB on Windows. Is there any way to install it on a Windows machine or do I need to use a Linux server for development purposes?
The current 0.9 branch of influxdb is pure go and can be compiled on Windows with the following commands:
cd %GOPATH%/src/github.com/influxdb
go get -u -f ./...
go build ./...
Of course you will need go (>1.4), git and hg.
If you do not want to compile your own version, you can also find here my own Windows x86 binaries for v0.9.0-rc11:
https://github.com/adriencarbonne/influxdb/releases/download/v0.9.0-rc11/influxdb_v0.9.0-rc11.zip
To run InfluxDB, type: influxd.exe.
Or even better, create the following config file, save it as influxdb.conf and run influxd --config influxdb.conf:
reporting-disabled = true
#[logging]
#level = "debug"
#file = "influxdb.log"
[admin]
enabled = true
port = 8083
[api]
port = 8086
[data]
dir = "data"
[broker]
dir = "broker"
I struggled quite a lot with this issue, so I'll post the full process step by step. This will hopefully help other people that lands on this post.
Table of contents:
Edit: WARNING, this doesn't work if Go and projects folder are installed to a custom path (not c:\go). In this case go get breaks with cryptic messages about unrecognized import paths (thanks to user626528 for the info)
PREVIOUS DOWNLOADS
COMPILATION
EXECUTION
1. PREVIOUS DOWNLOADS
Go for Windows (get the .msi):
https://golang.org/dl/
GIT for Windows:
http://git-scm.com/download/win
2. COMPILATION
cd to C:\Go
Create our $GOPATH in "C:\Go\projects" (anywhere but C:\Go\src, which is the $GOROOT).
> mkdir projects
Set to $GOPATH variable to this new directory:
> set GOPATH=C:\Go\projects
Pull the influxdb code from github into our $GOPATH:
> go get github.com/influxdata/influxdb
cd to C:\Go\projects\github.com\influxdata\influxdb
Pull the project dependencies:
> go get -u -f ./...
Finally, build the code:
> go build ./...
...this will create 3 executables under C:\Go\projects\bin:
influx.exe
influxd.exe
urlgen.exe
3. EXECUTION
To start the service:
influxd -config influxdb.conf
For that, you first need to create a influxdb.conf file with the following text:
reporting-disabled = true
#[logging]
#level = "debug"
#file = "influxdb.log"
#write-tracing = false
[admin]
enabled = true
port = 8083
[api]
port = 8086
[data]
dir = "data"
[broker]
dir = "broker"
Once the service is started, you can execute Chrome and go to http://localhost:8083, and start playing with InfluxDb.
Default values for username and password are:
username: root
password: root
Few updates to Xavier Peña solution to build latest influxdb. Notice the difference in github URL and the path.
C:\Go\projects>go get github.com/influxdata/influxdb
C:\Go\projects>go get github.com/sparrc/gdm
C:\Go\projects>cd C:\Go\projects\src\github.com\influxdata\influxdb
C:\Go\projects\src\github.com\influxdata\influxdb>go get -u -f ./...
C:\Go\projects\src\github.com\influxdata\influxdb>c:\Go\projects\bin\gdm.exe restore
C:\Go\projects\src\github.com\influxdata\influxdb>go build ./...
C:\Go\projects\src\github.com\influxdata\influxdb>go install ./...
C:\Go\projects\bin>influxd config > influxdb.generated.conf
C:\Go\projects\bin>influxd -config influxdb.generated.conf
Windows if officially supported. Go to https://portal.influxdata.com/downloads and download it from there.
The current 0.9 branch of influxdb is pure go and can be compiled on Windows. The main prerequisites are go 1.4, git (e.g. tortoisegit together with msysgit), hg (e.g. tortoisehg).
Using this setup I've successfully compiled and run influxdb on Win7 x64.
There wasn't an influxdb Windows version at Sep 30 '14, there were are only Linux and OSX versions.
Update: Current 0.9 version at present 04/09/2015 have a win version.
The "nightlies" build actually has windows executables now. The release version does not (there is an open issue for that).
Alternatively, downloading the released version and adding the .exe extension to the file names should work as well. You would have to generate the config file using the command:
influxd config >influxdb.conf
Update 2020 - InfluxDB is NOT recommended on windows
After going through countless of articles, it is generally NOT recommended to install InfluxDB directly on Windows. There are many issues. In terms of performance and stability. Official InfluxDB too does not support windows and has no plans for it in the future. This is further proven as the latest InfluxDB 2.0 does not include any windows binaries.
InfluxDB 2.0 does not include windows binaries
so?
Work Around? => DOCKERS for WINDOWS, Try it, it's easy and free
Dockers are free. If you intend to install docker on Windows Server, it's also free for Windows Server 2016 and above (Microsoft made a special deal with docker to provide them for free)
For those who are still in the VM world:
Dockers are NOT like Virtual Machines. It interacts directly with the host's file system via a windows service
Check the link below for a step by step guide:
https://www.open-plant.com/knowledge-base/how-to-install-influxdb-docker-for-windows-10/
We don't officially support Windows at this time. However, you should now be able to build from master. See this issue to track it closely and the comments at the bottom have a link to where you can get a compiled binary:
https://github.com/influxdata/influxdb/issues/5359
For create influxdb configuration file we can also use the below command
influxd config > influxdb.generated.conf
If you don't want to compile it yourself, the build is done by influxdata and can be found at URLs like : https://dl.influxdata.com/influxdb/releases/influxdb-1.0.0-beta2_windows_amd64.zip (just change the version number to have another (recent) version)
However, as mentionned by Paul Dix, Windows is not officially supported for the moment.
Go to influxdata.com click downloads
https://portal.influxdata.com/downloads/
Select version 1.7 because currently there are no binaries for 2.0.
Download Windows binary

Resources