Unable to Override default tomcat port when running Openmrs on docker

Tags: #<Tag:0x00007fa3f51aa428> #<Tag:0x00007fa3f51aa040>

Am running OpenMRS as a Docker conatiner on a remote virtual machine , I want to be able to override the default tomcat port from 8080 as i have several other servers using the same port on the machine.

am using this docker compose file from here

`version:`   `'2.1'`

 

`services:`

`  ` `openmrs-referenceapplication-mysql:`

`    ` `restart:`   `"always"`

`    ` `image:`   `mysql` `:` `5.6`

`    ` `command:`   `"mysqld --character-set-server=utf8 --collation-server=utf8_general_ci"`

`    ` `environment:`

`      ` `MYSQL_DATABASE:`   `$` `{` `MYSQL_DB` `:` `-openmrs` `}`

`      ` `MYSQL_ROOT_PASSWORD:`   `$` `{` `MYSQL_ROOT_PASSWORD` `:` `-Admin123` `}`

`      ` `MYSQL_USER:`   `$` `{` `MYSQL_USER` `:` `-openmrs` `}`

`      ` `MYSQL_PASSWORD:`   `$` `{` `MYSQL_PASSWORD` `:` `-Admin123` `}`

`    ` `healthcheck:`

`      ` `test:`   `"exit 0"`

`    ` `volumes:`

`      ` `-`   `openmrs-referenceapplication-mysql-data` `:` `/var/lib/mysql`

 

`  ` `openmrs-referenceapplication:`

`    ` `restart:`   `"always"`

`    ` `image:`   `openmrs/openmrs-reference-application-distro` `:` `demo`

`    ` `depends_on:`

`      ` `-`   `openmrs-referenceapplication-mysql`

`    ` `ports:`

`      ` `-`   `"8080:8080"`

`    ` `environment:`

`      ` `DB_DATABASE:`   `$` `{` `MYSQL_DB` `:` `-openmrs` `}`

`      ` `DB_HOST:`   `openmrs-referenceapplication-mysql`

`      ` `DB_USERNAME:`   `$` `{` `MYSQL_USER` `:` `-openmrs` `}`

`      ` `DB_PASSWORD:`   `$` `{` `MYSQL_PASSWORD` `:` `-Admin123` `}`

`      ` `DB_CREATE_TABLES:`   `'true'`

`      ` `DB_AUTO_UPDATE:`   `'true'`

`      ` `MODULE_WEB_ADMIN:`   `'true'`

`    ` `healthcheck:`

`      ` `test:`   `[` `"CMD"` `,`   `"curl"` `,`   `"-f"` `,`   `"http://localhost:8080/openmrs/"` `]`

`      ` `timeout:`   `20s`

`    ` `volumes:`

`      ` `-`   `openmrs-referenceapplication-data` `:` `/usr/local/tomcat/.OpenMRS/`

`      ` `-`   `/usr/local/tomcat/.OpenMRS/modules/ ` `# do not store modules in data`

`      ` `-`   `/usr/local/tomcat/.OpenMRS/owa/ ` `# do not store owa in data`

 

`volumes:`

`   ` `openmrs-referenceapplication-mysql-data:`

`   ` `openmrs-referenceapplication-data:`

i changed the ports as below

` `ports:`

`      ` `-`   `"8088:8088"`

But the logs still show that tomcat is running on 8080 (see below) , and the worst of it i cant acces it via 8080.

Starting ProtocolHandler ["http-apr-8080"] openmrs-referenceapplication_1 | Feb 12, 2020 11:03:38 AM org.apache.coyote.AbstractProtocol start openmrs-referenceapplication_1 | INFO: Starting ProtocolHandler ["ajp-apr-8009"]

,neither can i acces it via what i defined in my docker compose file

cc @dkayiwa @samuel34 @ruhanga

1 Like

You probably want to map the tomcat port 8080 to 8088 like, 8088:8080.

1 Like

Thanks @ruhanga , it worked. :wink:
I had innitially tried to do the mapping , but was mapping them the oppsite way ,in a wrong order