# Problems compiling with docker

**URL:** <https://discourse.orthanc-server.org/t/problems-compiling-with-docker/3334>\
**Category:** Google Groups archive\
**Created:** [March 25, 2023, 12:13pm UTC](https://discourse.orthanc-server.org/t/problems-compiling-with-docker/3334 "2023-03-25T12:13:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Holbrook](https://discourse.orthanc-server.org/letter_avatar_proxy/v4/letter/d/d2c977/32.png) [@David\_Holbrook](https://discourse.orthanc-server.org/u/David_Holbrook)\
**Post date:** [March 25, 2023, 12:13pm UTC](https://discourse.orthanc-server.org/t/problems-compiling-with-docker/3334/1 "2023-03-25T12:13:52Z")

</div>

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 [orthanc: log](https://hg.orthanc-server.com/orthanc/)  
RUN hg clone [orthanc-object-storage: log](https://hg.orthanc-server.com/orthanc-object-storage/)  
RUN hg clone [orthanc-databases: log](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  
.  
.

---

<div class="post-metadata">

**Author:** ![David\_Holbrook](https://discourse.orthanc-server.org/letter_avatar_proxy/v4/letter/d/d2c977/32.png) [@David\_Holbrook](https://discourse.orthanc-server.org/u/David_Holbrook)\
**Post date:** [March 25, 2023, 3:58pm UTC](https://discourse.orthanc-server.org/t/problems-compiling-with-docker/3334/2 "2023-03-25T15:58:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![David\_Holbrook](https://discourse.orthanc-server.org/letter_avatar_proxy/v4/letter/d/d2c977/32.png) [@David\_Holbrook](https://discourse.orthanc-server.org/u/David_Holbrook)\
**Post date:** [March 25, 2023, 10:08pm UTC](https://discourse.orthanc-server.org/t/problems-compiling-with-docker/3334/3 "2023-03-25T22:08:21Z")

</div>

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 [orthanc: log](https://hg.orthanc-server.com/orthanc/)  
RUN hg clone [orthanc-object-storage: log](https://hg.orthanc-server.com/orthanc-object-storage/)  
RUN hg clone [orthanc-databases: log](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.

---

<div class="post-metadata">

**Author:** ![David\_Holbrook](https://discourse.orthanc-server.org/letter_avatar_proxy/v4/letter/d/d2c977/32.png) [@David\_Holbrook](https://discourse.orthanc-server.org/u/David_Holbrook)\
**Post date:** [March 26, 2023, 12:46am UTC](https://discourse.orthanc-server.org/t/problems-compiling-with-docker/3334/4 "2023-03-26T00:46:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sdscotti](https://discourse.orthanc-server.org/user_avatar/discourse.orthanc-server.org/sdscotti/32/2563_2.png) [@sdscotti](https://discourse.orthanc-server.org/u/sdscotti)\
**Post date:** [March 26, 2023, 3:27pm UTC](https://discourse.orthanc-server.org/t/problems-compiling-with-docker/3334/5 "2023-03-26T15:27:02Z")

</div>

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/](https://bitbucket.org/osimis/orthanc-setup-samples/src/master/)

and these:

[https://bitbucket.org/osimis/orthanc-setup-samples/src/master/docker/](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.
