Docker Community Forums

Share and learn in the Docker community.

One docker image has different behaviour on different hosts

I have one docker image that run successfully on one host (host 1) , but on host 2 and 3, Jersey classes are not getting loaded.
I am using Jersey for creating a rest api in java.

My dockerfile is

FROM tomcat:8.0.51-jre8-alpine

COPY ./reasoner-api/target/reasoner-api.war /usr/local/tomcat/webapps/reasoner-api.war
EXPOSE 8080

CMD [“catalina.sh”,“run”]

I run the docker as:

docker run -d -p 8080:8080 -i -t semantic_web:latest

In host 1:

host 1: OC:Windows 10 pro OC Build 18363.900 64-bit

Docker version 19.03.8, build afacb8b

The jersey initiates successfully the classes of the rest api:

15-Jul-2020 07:49:38.566 INFO [localhost-startStop-1] com.sun.jersey.api.core.PackagesResourceConfig.init Scanning for root resource and provider classes in the packages:
  io.swagger.jaxrs.json
  io.swagger.jaxrs.listing
  restapi
15-Jul-2020 07:49:38.651 INFO [localhost-startStop-1] com.sun.jersey.api.core.ScanningResourceConfig.logClasses Root resource classes found:    
               class restapi.TestService                                                                                                                                                                                             
               class restapi.PropertyService        

host 2:

Windows 10 Pro, OC build 17763.1039
Docker version 19.03.8, build afacb8b

host 3:

OS: Linux 3.10.0-957.27.2.el7.x86_64 #1 SMP Mon Jul 29 17:46:05 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Docker version 19.03.12, build 48a66213fe

In host 2 and host 3, jersey rest api classes are not getting initiated:

14-Jul-2020 12:47:14.634 INFO [localhost-startStop-1] com.sun.jersey.api.core.PackagesResourceConfig.init Scanning for root resource and provider classes in the packages:
  io.swagger.jaxrs.json
  io.swagger.jaxrs.listing
  restapi
14-Jul-2020 12:47:14.676 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive /usr/local/tomcat/webapps/reasoner-api.war has finished in 13,273 ms

com.sun.jersey.api.core.ScanningResourceConfig.logClasses Root resource classes found line does not even appear in logs

Docker uses containerisation as a core technology, which relies on the concept of sharing a kernel between containers. If one Docker image relies on a Windows kernel and another relies on a Linux kernel, you cannot run those two images on the same OS.

I have one image which has as base image a linux kernel:
FROM tomcat:8.0.51-jre8-alpine
You can see it in the dockerfile that I quoted in my initial post.

Do you mean that it matters on which os the image is getting built?