C# Discord Bot – SQLite error in Docker container

  c#, discord, docker, dsharp+, sqlite

I’m trying to deploy a .NET-Core Discord-Bot on a VPS (Ubuntu 18.04 x64) with the DSharp library through Docker.

My project includes a SQLite database. I have no problems accessing data stuff when running it manually with Visual Studio, and my bot also sends commands.

However, when I try to send commands when I get my bot up and running with Docker, I get the following exception:

code = 277 (277), message = System.Data.SQLite.SQLiteException (0x800007EF): bad parameter or other API misuse

at System.Data.SQLite.SQLite3.Open(String strFilename, String vfsName, SQLiteConnectionFlags connectionFlags, SQLiteOpenFlagsEnum openFlags, Int32 maxPoolSize, Boolean usePool)

at System.Data.SQLite.SQLiteConnection.Open()

at System.Data.Common.DbConnection.OpenAsync(CancellationToken cancellationToken)

This is my docker-compose.yml file:

version: "3"
    build: .
    image: mydiscordbot

This is my dockerfile:

FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env

# 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/core/aspnet:3.1
COPY --from=build-env /app/out .

COPY config.json ./
COPY App.config ./
ENTRYPOINT ["dotnet", "bot.dll"]

I’m loading the Connection String to access my database from App.config.

Source: Docker Questions