Using official Osmimis pro image + aws S3 plugin + minio = curlCode: 6, Couldn't resolve host name

Hi,

I’m testing the version 1.3.0 of the plugin in the Docker images 21.6.2, with an entirely local setup using Docker compose with local PostgreSQL and local Minio.

docker inspect osimis.azurecr.io/orthanc-pro:latest

[

{

“Id”: “sha256:fcc0462f61f4884eb579213e79d27c854301906868a194e80a5450d5997b8081”,

“RepoTags”: [

osimis.azurecr.io/orthanc-pro:latest

],

“RepoDigests”: [

osimis.azurecr.io/orthanc-pro@sha256:c9b3c48b0349570dc4fa79c114532e805dbaba04f959bf2f1eb9cd9d81bfebe7

],

“Parent”: “”,

“Comment”: “”,

“Created”: “2021-06-29T10:19:19.783689535Z”,

“Container”: “0a978e7c137109ec582e791f9fa7bfde7eeefa455eb4352302299b9e494e4d82”,

Using the docs here:

https://book.orthanc-server.com/plugins/object-storage.html#emulation-of-aws-s3-using-minio

[Please note that MINIO_ACCESS_KEY and MINIO_SECRET_KEY have been deprecated in favour of MINIO_ROOT_USER and MINIO_ROOT_PASSWORD. See https://docs.min.io/docs/minio-docker-quickstart-guide.html]

My docker-compose has the following configuration for the Orthanc container (this is derived from the osimis.azurecr.io/orthanc-pro:latest image but with some additional python modules being pip installed.

container_name: my-orthanc

build:

context: .

dockerfile: Dockerfile

cache_from:

volumes:

  • ./python/:/python

  • /tmp/orthanc-db/:/var/lib/orthanc/db/

networks:

local:

environment:

  • VERBOSE_ENABLED=false

  • DEFAULT_LOG_LEVEL=INFO

  • DICOM_WEB_PLUGIN_ENABLED=true

  • ORTHANC__PYTHON_SCRIPT=“/python/main.py”

  • ORTHANC__PYTHON_VERBOSE=false

  • AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}

  • AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}

  • AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION}

  • POSTGRESQL_PLUGIN_ENABLED=true

  • ORTHANC__POSTGRESQL__ENABLE_INDEX=true

  • ORTHANC__POSTGRESQL__ENABLE_STORAGE=false

  • ORTHANC__POSTGRESQL__ENABLE_SSL=false

  • ORTHANC__POSTGRESQL__HOST=postgres

  • ORTHANC__POSTGRESQL__PORT=5432

  • ORTHANC__POSTGRESQL__DATABASE=orthanc

  • ORTHANC__POSTGRESQL__USERNAME=postgres

  • ORTHANC__POSTGRESQL__PASSWORD=foobar

  • ORTHANC__AWS_S3_STORAGE__BUCKET_NAME=platform-local-orthanc-files

  • ORTHANC__AWS_S3_STORAGE__REGION=eu-west-2

  • ORTHANC__AWS_S3_STORAGE__ACCESS_KEY=

  • ORTHANC__AWS_S3_STORAGE__SECRET_KEY=

  • ORTHANC__AWS_S3_STORAGE__VIRTUALADDRESSING=false

  • ORTHANC__AWS_S3_STORAGE__ENDPOINT=http://minio:9000/

secrets:

  • orthanc.secret.json

restart: unless-stopped

minio:

command: “server /data”

container_name: orthanc-minio

image: minio/minio

ports: [9000:9000]

networks:

local:

environment:

  • MINIO_REGION= eu-west-2

  • MINIO_ROOT_USER=

  • MINIO_ROOT_PASSWORD=

volumes:

  • ./localstorage/minio:/data

restart: unless-stopped

When I then try to POST an instance into the server I receive the following error:

my-orthanc | 2021-07-06T10:37:20.266188600Z E0706 10:37:20.266046 PluginsManager.cpp:197] Exception while invoking plugin service 3002: Error in the plugin implementing a custom storage area

my-orthanc | 2021-07-06T10:37:20.265914200Z E0706 10:37:20.265640 PluginsManager.cpp:164] AWS S3 Storage: error while creating object 46fadded-bec5-45c3-ada5-93164e8e8da7: error while writing file 46fadded-bec5-45c3-ada5-93164e8e8da7.dcm: curlCode: 6, Couldn’t resolve host name

my-orthanc | 2021-07-06T10:37:20.266771800Z E0706 10:37:20.266593 PluginsManager.cpp:164] Error in the REST callback, traceback:

my-orthanc | 2021-07-06T10:37:20.266816900Z <class ‘ValueError’>

my-orthanc | 2021-07-06T10:37:20.266826900Z Internal error

my-orthanc | 2021-07-06T10:37:20.266830400Z

my-orthanc | 2021-07-06T10:37:20.266832900Z File “/python/rest.py”, line 179, in OnRestInstances

my-orthanc | 2021-07-06T10:37:20.266836800Z coreApiResponse = orthanc.RestApiPost(“/instances”, request[“body”])

my-orthanc | 2021-07-06T10:37:20.266841400Z

my-orthanc | 2021-07-06T10:37:20.266845400Z E0706 10:37:20.266693 PluginsErrorDictionary.cpp:111] Exception inside the plugin engine: Error encountered within the plugin engine

orthanc-nginx | 2021-07-06T10:37:20.267511600Z 172.27.0.1 - - [06/Jul/2021:10:37:20 +0000] “POST /instances HTTP/1.1” 500 291 “-” “curl/7.68.0” “-”

To debug this I connected to the Orthanc container (docker container exec -it my-orthanc /bin/bash) and used the python REPL to test that boto3 can talk to the minio instance from the Orthance container:

root@f481526c1de2:/# export AWS_ACCESS_KEY_ID=

root@f481526c1de2:/# export AWS_SECRET_ACCESS_KEY=

root@f481526c1de2:/# python3

Python 3.7.3 (default, Jan 22 2021, 20:04:44)

[GCC 8.3.0] on linux

Type “help”, “copyright”, “credits” or “license” for more information.

import boto3

s3 = boto3.resource(‘s3’, endpoint_url=http://minio:9000)

bucket = s3.Bucket(‘testbucket’)

file_list = [s.key for s in list(bucket.objects.all())]

print(file_list)

[‘ML Workflow.jpg’, ‘patch.diff’]

We have had the S3 plugin working on earlier versions of the Osimis image using AWS cloud backend (e.g not minio). The new ENV VAR that I have added in local docker-compose setup are:

ORTHANC__AWS_S3_STORAGE__VIRTUALADDRESSING=false

ORTHANC__AWS_S3_STORAGE__ENDPOINT=http://minio:9000/

Has anyone else successfully used minio with Orthanc via docker-compose? Is this related to something new in the 21.6.2 release? Bitbucket

Anything else I can try?

Is the source code to the official S3 plugin available anywhere?

Thanks in advance

Darren

Hello Darren,

After a very long investigation, I think I have spotted the error… that seems to be a simple typo. From your original post:

On Tuesday, July 6, 2021 at 2:02:47 PM UTC+2 daz...@gmail.com wrote:

I’m testing the version 1.3.0 of the plugin in the Docker images 21.6.2, with an entirely local setup using Docker compose with local PostgreSQL and local Minio. […]
- ORTHANC__AWS_S3_STORAGE__VIRTUALADDRESSING=false
- ORTHANC__AWS_S3_STORAGE__ENDPOINT=http://minio:9000/

=> You use the environment variable “ORTHANC__AWS_S3_STORAGE__VIRTUALADDRESSING”, but you should use “ORTHANC__AWS_S3_STORAGE__VIRTUAL_ADDRESSING” (note the missing underscore between “virtual” and “addressing”).

The explanation about how to map some configuration option (in the present case, “VirtualAddressing” in section “AwsS3Storage”) to an environment variable of the “osimis/orthanc” images is given in the Orthanc Book:

https://book.orthanc-server.com/users/docker-osimis.html#environment-variables

Please could you give a try?

Regards,
Sébastien-