Dotnet-docker: Application hangs on opening an SQL connection in docker container based on mcr.microsoft.com/dotnet/core/sdk:3.0-buster-slim (Debian 10)

Created on 14 Oct 2019  路  2Comments  路  Source: dotnet/dotnet-docker

Steps to reproduce the issue

  1. Run the attached .NET Core 3.0 application as docker container.

_or_

  1. Create a .NET Core 3.0 Console Application.
  2. Change the Progam.cs file so it creates a new _System.Data.SqlClient.SqlConnection()_ and open this connection by calling _Open()_ or _OpenAsync()_.
  3. Build and run the application as docker, targetting _mcr.microsoft.com/dotnet/core/runtime:3.0-buster-slim_ (default base image).

Expected behavior

The connection gets opened and the application continues.

Actual behavior

The connection does not get opened, the application hangs on the .Open() method call.

Additional information

The issue only occurs in docker images based on mcr.microsoft.com/dotnet/core/runtime:3.0-buster-slim (tested 3.0.0-alpine3.9, 3.0.0-disco, 3.0.0-bionic, the code runs fine in these containers).

Output of docker version

Client: Docker Engine - Community
 Version:           18.09.2
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        6247962
 Built:             Sun Feb 10 04:12:31 2019
 OS/Arch:           windows/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.2
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.6
  Git commit:       6247962
  Built:            Sun Feb 10 04:13:06 2019
  OS/Arch:          linux/amd64
  Experimental:     false

Output of docker info

Containers: 43
 Running: 1
 Paused: 0
 Stopped: 42
Images: 133
Server Version: 18.09.2
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9754871865f7fe2f4e74d43e2fc7ccd237edcbce
runc version: 09c8266bf2fcf9519a651b04ae54c967b9ab86ec
init version: fec3683
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.125-linuxkit
Operating System: Docker for Windows
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.934GiB
Name: linuxkit-00155de3300c
ID: 3HKI:LSNS:WMPD:J4SS:6YT7:VWZN:AI4P:X7N3:7QMJ:C6K5:NYJU:CO7W
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 36
 Goroutines: 62
 System Time: 2019-10-14T12:37:16.6440944Z
 EventsListeners: 3
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine

Most helpful comment

Ah yes, indeed. I had not yet found the issue and the solution posted there. Thanks 馃憤

I can confirm that adding the following two lines to the Dockerfile fixes the issue:

RUN sed -i 's/DEFAULT@SECLEVEL=2/DEFAULT@SECLEVEL=1/g' /etc/ssl/openssl.cnf
RUN sed -i 's/DEFAULT@SECLEVEL=2/DEFAULT@SECLEVEL=1/g' /usr/lib/ssl/openssl.cnf

All 2 comments

Ah yes, indeed. I had not yet found the issue and the solution posted there. Thanks 馃憤

I can confirm that adding the following two lines to the Dockerfile fixes the issue:

RUN sed -i 's/DEFAULT@SECLEVEL=2/DEFAULT@SECLEVEL=1/g' /etc/ssl/openssl.cnf
RUN sed -i 's/DEFAULT@SECLEVEL=2/DEFAULT@SECLEVEL=1/g' /usr/lib/ssl/openssl.cnf
Was this page helpful?
0 / 5 - 0 ratings