I'm trying to run a C# app with Telegram TDlib in docker, but it immediately stops with exit code 139. This is a fresh setup, and the container doesn't generate a log. TDLib files were generated with https://tdlib.github.io/td/build.html and saved in build64 directory. On local machine this project work well and also after receiving files from created image and running it on local machine it works well. But docker container can't run and returns the exception 139. I received these files with command below and visual studio code (Docker extension)
docker run --rm -it --entrypoint=/bin/bash image-name
- App
- - build64 (TDLib)
- - - Debug
- - - Release
- - Program.cs
- - App.csproj
App.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>x64</Platforms>
</PropertyGroup>
<PropertyGroup>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<None Remove="Azure.Identity" />
<None Remove="Azure.Security.KeyVault.Secrets" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.17.0" />
</ItemGroup>
<ItemGroup>
<Reference Include="Telegram.Td, Version=0.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>build64\$(Configuration)\Telegram.Td.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
<Content Include="build64\$(Configuration)\zlib1.dll">
<Link>zlib1.dll</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<Content Include="build64\$(Configuration)\zlibd1.dll">
<Link>zlibd1.dll</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
<Content Include="build64\$(Configuration)\libcrypto-1_1-x64.dll">
<Link>libcrypto-1_1-x64.dll</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="build64\$(Configuration)\libssl-1_1-x64.dll">
<Link>libssl-1_1-x64.dll</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<Content Include="build64\$(Configuration)\libcrypto-1_1-x64.dll">
<Link>libcrypto-1_1-x64.dll</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="build64\$(Configuration)\libssl-1_1-x64.dll">
<Link>libssl-1_1-x64.dll</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>
Dockerfile is auto generated file with Visual Studio 2022:
FROM mcr.microsoft.com/dotnet/runtime:6.0 AS base
WORKDIR /app
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["App/App.csproj", "App/"]
RUN dotnet restore "App/App.csproj"
COPY . .
WORKDIR "/src/App"
RUN dotnet build "App.csproj" -a x64 -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "App.csproj" -a x64 -c Release -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "App.dll"]
- On the local machine this project works well and also after receiving files from created image and running it on local machine it works well. But docker container can't run and returns the exception 139.
- Tried to copy files singly or copy all files from Release directory
COPY ["App/build64/Release/libcrypto-1_1-x64.dll", "/app/publish/"]
COPY ["App/build64/Release/libssl-1_1-x64.dll", "/app/publish/"]
COPY ["App/build64/Release/tdjson.dll", "/app/publish/"]
COPY ["App/build64/Release/zlib1.dll", "/app/publish/"]