Closed ghilainm closed 2 years ago
The workaround to solve that issue is to create the config directory beforehand with a custom docker image.
FROM mockserver/mockserver:mockserver-5.11.2
COPY config config
ENV MOCKSERVER_PROPERTY_FILE "/config/mockserver.properties"
ENV MOCKSERVER_PERSISTED_EXPECTATIONS_PATH "/config/mockserverInitialization.json"
ENV MOCKSERVER_INITIALIZATION_JSON_PATH "/config/mockserverInitialization.json"
ENV MOCKSERVER_PERSIST_EXPECTATIONS "TRUE"
EXPOSE 1080
MockServer can't persistence files to a read only file system, your'll need something like the following:
mock-server:
image: mockserver/mockserver:mockserver-5.12.0
environment:
MOCKSERVER_LOG_LEVEL: DEBUG
MOCKSERVER_PERSIST_EXPECTATIONS: "true"
MOCKSERVER_PERSISTED_EXPECTATIONS_PATH: /config/persistedExpectations.json
volumes:
- ./config:/config
This will save the expectations to a config
subdirectory (i.e. ./config
) inside the directory where you run docker-compose
from.
Describe the issue Trying to persist expectation inside docker container run into permission defined.
What you are trying to do Description of what you are trying to do so we can understand the context of the problem
MockServer version 5.11.2
To Reproduce Use a docker-compose file. Try to upload an open API definition.
Compose snippet:
Expected behaviour No excption
MockServer Log