nextgenhealthcare / connect-docker

Official Dockerfiles for Connect https://hub.docker.com/r/nextgenhealthcare/connect
Mozilla Public License 2.0
78 stars 51 forks source link

Docker run exited: Can't read /opt/connect/conf/mirth.properties: Permission denied #4

Closed bartverhoevenaxxes closed 4 years ago

bartverhoevenaxxes commented 4 years ago

OS: Ubuntu Server 16.04.6 Docker version: 19.03.6

The "docker run" command that is on the Nextgen Docker hub starts the container but exits immediately after starting with the following error: sed: can't read /opt/connect/conf/mirth.properties: Permission denied. This problem occurs since this week (19/02/2020) and occurs on multiple servers.

Nextgen issue

Version 3.8.0 starts without errors.

cturczynskyj commented 4 years ago

I've tested this locally and cannot reproduce it. Here's my output:

$ docker run --name myconnect -d -p 8443:8443 nextgenhealthcare/connect:latest
Unable to find image 'nextgenhealthcare/connect:latest' locally
latest: Pulling from nextgenhealthcare/connect
dc65f448a2e2: Pull complete 
346ffb2b67d7: Pull complete 
dea4ecac934f: Pull complete 
f003f5c25f68: Pull complete 
ba2ac43bf199: Pull complete 
9599f5be1d38: Pull complete 
35c2257fb615: Pull complete 
d802968d8ffa: Pull complete 
46188f9a775c: Pull complete 
fce6720d12b5: Pull complete 
7ab76c471ab8: Pull complete 
aa519180c3bf: Pull complete 
062eaf310c4c: Pull complete 
9bf1a0aa5c1a: Pull complete 
804191eb3568: Pull complete 
Digest: sha256:fa4dbe35157489272ce5c613628b6a6ea418b3e9a320c079b01701c6bb4ac849
Status: Downloaded newer image for nextgenhealthcare/connect:latest
175f520cb0ab5f90acc5244fa3fb3ef5c1d11f93ed9b9dbc8a5443ec499de637
$ docker ps -a
CONTAINER ID        IMAGE                              COMMAND                  CREATED             STATUS                    PORTS                    NAMES
175f520cb0ab        nextgenhealthcare/connect:latest   "/entrypoint.sh ./mc…"   5 seconds ago       Up 4 seconds              0.0.0.0:8443->8443/tcp   myconnect
$ docker logs -f myconnect
INFO  2020-02-19 18:51:08,730 [Main Server Thread] com.mirth.connect.server.Mirth: Mirth Connect 3.8.1 (Built on September 12, 2019) server successfully started.
INFO  2020-02-19 18:51:08,737 [Main Server Thread] com.mirth.connect.server.Mirth: This product was developed by NextGen Healthcare (https://www.nextgen.com) and its contributors (c)2005-2020.
INFO  2020-02-19 18:51:08,739 [Main Server Thread] com.mirth.connect.server.Mirth: Running OpenJDK 64-Bit Server VM 11.0.6 on Linux (4.19.76-linuxkit, amd64), derby, with charset UTF-8.
INFO  2020-02-19 18:51:08,745 [Main Server Thread] com.mirth.connect.server.Mirth: Web server running at http://172.17.0.2:8080/ and https://172.17.0.2:8443/
$ docker container ls -a
CONTAINER ID        IMAGE                              COMMAND                  CREATED             STATUS                    PORTS                    NAMES
175f520cb0ab        nextgenhealthcare/connect:latest   "/entrypoint.sh ./mc…"   6 minutes ago       Up 6 minutes              0.0.0.0:8443->8443/tcp   myconnect
$ docker images
REPOSITORY                  TAG                 IMAGE ID            CREATED             SIZE
nextgenhealthcare/connect   latest              21b971b15a84        5 days ago          875MB
$ docker images --digests nextgenhealthcare/connect
REPOSITORY                  TAG                 DIGEST                                                                    IMAGE ID            CREATED             SIZE
nextgenhealthcare/connect   latest              sha256:fa4dbe35157489272ce5c613628b6a6ea418b3e9a320c079b01701c6bb4ac849   21b971b15a84        5 days ago          875MB
$ docker --version
Docker version 19.03.5, build 633a0ea

Do you see the same image ID? 21b971b15a84 and digest? sha256:fa4dbe35157489272ce5c613628b6a6ea418b3e9a320c079b01701c6bb4ac849

The digest should match what you see as latest in Docker Hub.

Screen Shot 2020-02-19 at 11 23 37 AM

Maybe try pulling the image again?

cturczynskyj commented 4 years ago

Closing this issue, unable to reproduce.

jtc42 commented 2 years ago

I'm getting the same issue and I think its related to permissions when you're mounting appdata as a volume. The dockerfile seems to assume everything will be running as a user with PID 1000, so if your user with PID 1000 on the host doesn't have write permissions to your volume directory then you get this error. Annoyingly, PID 1000 is just the default first user on Ubuntu for example, and there doesn't seem to be any way to change the PID of the user in the Connect container so you have no choice but to grant that first user on the host write permissions to the appdata volume.

tonygermano commented 2 years ago

@jtc42 You can change this line in the Dockerfile and build the image yourself if you want to assign the mirth user in the container a different id. https://github.com/nextgenhealthcare/connect-docker/blob/56878038be9dc66ae0f1500f503a90885b731503/Dockerfile#L14

I think it's set that way specifically to make it easier to view and edit those files as the user typically logged in to the host, especially during development if running on a laptop/pc.

jtc42 commented 2 years ago

@jtc42 You can change this line in the Dockerfile and build the image yourself if you want to assign the mirth user in the container a different id.

https://github.com/nextgenhealthcare/connect-docker/blob/56878038be9dc66ae0f1500f503a90885b731503/Dockerfile#L14

I think it's set that way specifically to make it easier to view and edit those files as the user typically logged in to the host, especially during development if running on a laptop/pc.

Thanks!