If you have volumes:
that binds a host directory to a container directory, at container startup time, the contents of that host directory always completely hide anything that was in the underlying image. In your case, you’re mounting a directory over the directory that contains the jar file, so the actual application gets hidden.
You should restructure your application to keep the data somewhere separate from the application code. Using simple top-level directories like /app
and /data
is common enough, or you can make the data directory a subdirectory of your application directory.
Once you’ve done this, you can change the volumes:
mount to a different directory:
# for example, a "data" subdirectory of the application directory
volumes:
- /test/mock-data/Ngocs-Rest-Mock:/usr/src/ngocs-rest-mock/data
CLICK HERE to find out more related problems solutions.