Problems compiling with docker

If I attempt to compile with MySQL I get the following errors:
docker build -t orthanc-img .

FROM debian:bullseye-slim
Label maintainer “davidh”

Port exposure 4242-DICOM 8042-web

EXPOSE 4242/tcp
EXPOSE 8042/tcp

Dockerfile args

ARG BASE_DIR=/root

Regional settings

ARG DEBIAN_FRONTEND=noninteractive ## accepts the default answer for all questions
ENV TZ=Etc/UTC

install dependencies

RUN apt update && apt upgrade -y
RUN apt install curl wget tar zip unzip patch tzdata -y
RUN apt install libpq-dev postgresql-server-dev-all -y
RUN apt install mercurial -y
RUN apt install cmake build-essential pkg-config zlib1g-dev libssl-dev
libcurl4-openssl-dev libgtest-dev libjsoncpp-dev libcrypto+±dev uuid-dev
libboost-all-dev libsqlite3-dev libccd-dev ninja-build libcurl4-openssl-dev
liblua5.1-0-dev libpng-dev libjpeg-dev libdcmtk2-dev libwrap0-dev libpugixml-dev
libcivetweb-dev -y

RUN apt autoremove
RUN apt clean
RUN rm -rf /var/lib/apt/lists/*

WORKDIR $BASE_DIR

Get orthanc repos

RUN hg clone https://hg.orthanc-server.com/orthanc/
RUN hg clone https://hg.orthanc-server.com/orthanc-object-storage/
RUN hg clone https://hg.orthanc-server.com/orthanc-databases/

Create build directories

RUN mkdir orthanc/build
RUN mkdir orthanc-object-storage/build
RUN mkdir orthanc-databases/build

Create Orthanc directories

RUN mkdir -p /etc/orthanc
RUN mkdir -p /usr/share/orthanc/plugins

# Orthanc S3 Plugin

WORKDIR $BASE_DIR/orthanc-object-storage/build

RUN cmake -DCMAKE_BUILD_TYPE:STRING=Release -DUSE_VCPKG_PACKAGES=OFF -DORTHANC_FRAMEWORK_SOURCE=path -DORTHANC_FRAMEWORK_ROOT=$BASE_DIR/orthanc/OrthancFramework/Sources …/Aws

RUN make -j 4

RUN cp *.so /usr/share/orthanc/plugins/

# Orthanc PostgreSQL Plugin

WORKDIR $BASE_DIR/orthanc-databases/build

RUN cmake -DALLOW_DOWNLOADS=ON -DCMAKE_BUILD_TYPE:STRING=Release -DUSE_SYSTEM_GOOGLE_TEST=ON -DUSE_SYSTEM_ORTHANC_SDK=OFF …/PostgreSQL

RUN make -j 4

RUN cp *.so /usr/share/orthanc/plugins/

Orthanc MySQL plug-in

WORKDIR $BASE_DIR/orthanc-databases/build
RUN cmake -DALLOW_DOWNLOADS=ON -DCMAKE_BUILD_TYPE:STRING=Release -DUSE_SYSTEM_GOOGLE_TEST=ON -DUSE_SYSTEM_ORTHANC_SDK=OFF …/MySQL
RUN make -j 4
RUN cp *.so /usr/share/orthanc/plugins/

Orthanc server build

WORKDIR $BASE_DIR/orthanc/build
RUN cmake -DALLOW_DOWNLOADS=ON -DCMAKE_BUILD_TYPE:STRING=Release -DSTANDALONE_BUILD=ON -DUSE_GOOGLE_TEST_DEBIAN_PACKAGE=ON -DUSE_SYSTEM_CIVETWEB=OFF -DUSE_SYSTEM_DCMTK=OFF -DUSE_SYSTEM_OPENSSL=OFF -DUSE_SYSTEM_CURL=OFF …/OrthancServer
RUN make -j 4
RUN make install

Copy local files

COPY *.json /etc/orthanc

Change permissions to execute

RUN chmod +x /usr/share/orthanc/plugins/*
RUN chmod +x /usr/local/bin/*

Run Orthanc

WORKDIR /usr/local/sbin/
CMD [ “Orthanc”, “-verbose”, “–trace”, “/etc/orthanc/” ]

.
.
=> ERROR [20/30] RUN cmake -DALLOW_DOWNLOADS=ON -DCMAKE_BUILD_TYPE:STRING=Release -DUSE_SYSTEM_GOOGLE_TEST=ON -DUSE_SYSTEM_ORTHANC_SDK=OFF …/MySQL
.
.

Now that I am getting a better understanding of what is going on it appears that this is a depreciation and Debian bullseye binary issue.

mariadb has superseded mysql so:

#RUN apt install libmysqlclient-dev libpq-dev postgresql-server-dev-all -y
RUN apt-get install libmariadb-dev-compat libmariadb-dev libpq-dev postgresql-server-dev-all -y

fixes one problem but

#RUN apt-get libboost-all-dev libsqlite3-dev libccd-dev ninja-build libcurl4-openssl-dev -y
#RUN apt-get liblua5.1-0-dev libpng-dev libjpeg-dev libdcmtk2-dev libwrap0-dev libpugixml-dev -y

Are not available and prevent me from compiling the orhtanc mysql module

I was able to install libboost-all-dev from my desktop so step by step I worked through the Dockerfile and got the compile to work.
I did notice that it works best on a fresh instance and will fail if PostgreSQL was previously compiled.

The following Dockerfile is functional.

FROM debian:bullseye-slim
Label maintainer “davidh”

Port exposure 4242-DICOM 8042-web

EXPOSE 4242/tcp
EXPOSE 8042/tcp

Dockerfile args

ARG BASE_DIR=/root

Regional settings

ARG DEBIAN_FRONTEND=noninteractive ## accepts the default answer for all questions
ENV TZ=Etc/UTC

install dependencies

RUN apt-get update && apt upgrade -y
RUN apt-get install curl wget tar zip unzip patch tzdata -y
#RUN apt install libmysqlclient-dev -y
RUN apt-get install libmariadb-dev-compat libmariadb-dev libpq-dev postgresql-server-dev-all -y
RUN apt-get install mercurial -y
RUN apt-get install cmake build-essential pkg-config zlib1g-dev libssl-dev -y
RUN apt-get install libcurl4-openssl-dev libgtest-dev libjsoncpp-dev libcrypto+±dev uuid-dev -y

RUN apt-get install libboost-all-dev libsqlite3-dev libccd-dev ninja-build libcurl4-openssl-dev -y
RUN apt-get install liblua5.1-0-dev libpng-dev libjpeg-dev libdcmtk2-dev libwrap0-dev libpugixml-dev -y

RUN apt autoremove
RUN apt clean
RUN rm -rf /var/lib/apt/lists/*

WORKDIR $BASE_DIR

Get orthanc repos

RUN hg clone https://hg.orthanc-server.com/orthanc/
RUN hg clone https://hg.orthanc-server.com/orthanc-object-storage/
RUN hg clone https://hg.orthanc-server.com/orthanc-databases/

Create build directories

RUN mkdir orthanc/build
RUN mkdir orthanc-object-storage/build
RUN mkdir orthanc-databases/build

Create Orthanc directories

RUN mkdir -p /etc/orthanc
RUN mkdir -p /usr/share/orthanc/plugins

Orthanc S3 Plugin

WORKDIR $BASE_DIR/orthanc-object-storage/build
RUN cmake -DCMAKE_BUILD_TYPE:STRING=Release -DUSE_VCPKG_PACKAGES=OFF -DORTHANC_FRAMEWORK_SOURCE=path -DORTHANC_FRAMEWORK_ROOT=$BASE_DIR/orthanc/OrthancFramework/Sources …/Aws
RUN make -j 4
RUN cp *.so /usr/share/orthanc/plugins/

# Orthanc PostgreSQL Plugin

WORKDIR $BASE_DIR/orthanc-databases/build

RUN cmake -DALLOW_DOWNLOADS=ON -DCMAKE_BUILD_TYPE:STRING=Release -DUSE_SYSTEM_GOOGLE_TEST=ON -DUSE_SYSTEM_ORTHANC_SDK=OFF …/PostgreSQL

RUN make -j 4

RUN cp *.so /usr/share/orthanc/plugins/

Orthanc MySQL plug-in

WORKDIR $BASE_DIR/orthanc-databases/build
RUN cmake -DALLOW_DOWNLOADS=ON -DCMAKE_BUILD_TYPE:STRING=Release -DUSE_SYSTEM_GOOGLE_TEST=ON -DUSE_SYSTEM_ORTHANC_SDK=OFF …/MySQL
RUN make -j 4
RUN cp *.so /usr/share/orthanc/plugins/

Orthanc server build

WORKDIR $BASE_DIR/orthanc/build
RUN cmake -DALLOW_DOWNLOADS=ON -DCMAKE_BUILD_TYPE:STRING=Release -DSTANDALONE_BUILD=ON -DUSE_GOOGLE_TEST_DEBIAN_PACKAGE=ON -DUSE_SYSTEM_CIVETWEB=OFF -DUSE_SYSTEM_DCMTK=OFF -DUSE_SYSTEM_OPENSSL=OFF -DUSE_SYSTEM_CURL=OFF …/OrthancServer
RUN make -j 4
RUN make install

Copy local files

COPY *.json /etc/orthanc

Change permissions to execute

RUN chmod +x /usr/share/orthanc/plugins/*
RUN chmod +x /usr/local/bin/*

Run Orthanc

WORKDIR /usr/local/sbin/
CMD [ “Orthanc”, “-verbose”, “–trace”, “/etc/orthanc/” ]

At this point I am getting the following mysql error:
MySQL error (2002,HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)
I have not been able to run #mysql_secure_installation and am not sure how to configure the database.

mysql.json is as follows:

{
/**

  • Configuration to use MySQL or MariaDB instead of the default
  • SQLite back-end of Orthanc. You will have to install the
  • “orthanc-mysql” package to take advantage of this feature.
    **/
    “MySQL” : {
    // Enable the use of MySQL to store the Orthanc index?
    “EnableIndex” : true,

// Enable the use of MySQL to store the DICOM files?
“EnableStorage” : true,

// Parameters of the MySLQ database
“Host” : “localhost”,
“Port” : 3306,
“Database” : “orthanc_db”,
“Username” : “orthanc_user”,
“UnixSocket” : “/var/run/mysqld/mysqld.sock”,
“Password” : “my_password”,

// Whether to enable the locking of the MySQL database
“Lock” : true,

// Whether to connect to MySQL using SSL (new in 3.0)
“EnableSsl” : false,

// Number of retries when connecting to MySQL, or when conccurent
// transactions cannot be serialized (new in 3.0)
“MaximumConnectionRetries” : 10,

// Number of seconds between two attempts when opening a
// connection to MySQL (new in 3.0)
“ConnectionRetryInterval” : 5,

// Number of connections to MySQL in the connection pool
// of the index back-end (new in 4.0)
“IndexConnectionsCount” : 1
}
}

I am not sure how to complete the mysql is configuration.

At this point I am not sure how to work with docker as I can not even run a systemctl status mysql to verify if mysql is running or how to get it running.

Are you using Docker Compose or just Dockerfiles ? If you haven’t referenced these, you might want to look at them:

https://bitbucket.org/osimis/orthanc-setup-samples/src/master/

and these:

https://bitbucket.org/osimis/orthanc-setup-samples/src/master/docker/

It is usually pretty simple to get the Osimis Docker setups up and running in a short time. If you are not using a docker-compose.yml you will have trouble.