question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Confluent.Kafka cannot find librdkafka when running from dotnetcore 2.0 in docker

See original GitHub issue

sadkafka.zip Description

Dotnet core 2 app cannot find librdkafka when running in docker image derived from the microsoft/dotnet base image

How to reproduce

Code attached.

  • Ensure you have dotnet core sdk 2 installed
  • Extract attached arcive
  • dotnet publish sadkafka.csproj (if you want; I already built it)
  • docker build --tag sadkafka .

If you were to navigate to /bin/Debug/netcoreapp2.0/publish and exec dotnet sadkafka.dll, everything works fine, however if you run the following

  • ‘docker run sadkafka’

You should see the following stacktrace


zopadev@ubuntu:/media/sf_git/kafkaschmafka$ docker run sadkafka
Running...
Unhandled Exception: System.TypeInitializationException: The type initializer for 'Confluent.Kafka.Impl.LibRdKafka' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'librdkafka': The specified module or one of its dependencies could not be found.
 (Exception from HRESULT: 0x8007007E)
   at Confluent.Kafka.Impl.LibRdKafka.NativeMethods.rd_kafka_version()
   at Confluent.Kafka.Impl.LibRdKafka..cctor()
   --- End of inner exception stack trace ---
   at Confluent.Kafka.Impl.LibRdKafka.conf_new()
   at Confluent.Kafka.Impl.SafeConfigHandle.Create()
   at Confluent.Kafka.Producer..ctor(IEnumerable`1 config, Boolean manualPoll, Boolean disableDeliveryReports)
   at Confluent.Kafka.Producer`2..ctor(IEnumerable`1 config, ISerializer`1 keySerializer, ISerializer`1 valueSerializer, Boolean manualPoll, Boolean disableDeliveryReports)
   at sadkafka.Program.Main(String[] args) in D:\git\kafkaschmafka\Program.cs:line 22

Checklist

Please provide the following information:

  • Confluent.Kafka nuget version: 0.11.0
  • Apache Kafka version: na
  • Client configuration: na
  • Operating system: ubuntu, windows (works) vs docker: microsoft/dotnet (based on debian:stretch)
  • Provide logs (with “debug” : “…” as necessary in configuration) NA
  • Provide broker log excerpts NA
  • Critical issue Its blocking us (and we have a support contract with you)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:33 (16 by maintainers)

github_iconTop GitHub Comments

7reactions
mhowlettcommented, Oct 22, 2017

Currently working on it. I’m re-packaging librdkafka.redist and making some changes to the dotnet library to make native library loading more flexible. I thought it would be done by now but it’s turned out to be quite difficult.

7reactions
treziaccommented, Aug 17, 2017

@spadger Use microsoft/dotnet:2-runtime-jessie or 2-sdk-jessie in your docker file, this will work (for reference, this comes from dependencies installed here: https://github.com/dotnet/dotnet-docker/blob/master/2.0/sdk/jessie/amd64/Dockerfile https://github.com/dotnet/dotnet-docker/blob/master/2.0/sdk/stretch/amd64/Dockerfile )

Read more comments on GitHub >

github_iconTop Results From Across the Web

Writing to Kafka from .net core service using Confluent.Kafka
I tried installing Confluent.Kafka package and do the logging, it works fine when running locally. But in the container, the service cannot log ......
Read more >
Why Can't I Connect to Kafka? | Troubleshoot Connectivity
It's written using Python with librdkafka ( confluent_kafka ), but the principle applies to clients ... Scenario 2: Kafka and client running in...
Read more >
confluent-kafka-dotnet
NET client for Apache Kafka and the Confluent Platform. Features: High performance - confluent-kafka-dotnet is a lightweight wrapper around librdkafka, a finely ...
Read more >
Confluent kafka github
Option 1: Run a Kafka cluster on your local host. md Confluent Kafka with docker-compose This is an example app of how setup...
Read more >
Confluent kafka github
Reliability - There are a lot of details to get right when writing an Apache Kafka client. Naming the chart --name my-confluent-oss is ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found