docker-composemockingmockoon

Mockoon Docker compose : Error: Missing required flag


I'm trying to run mockoon docker cli using docker compose for my mock api and i have the json exported to my directory,

version: "3"
services:
  mockoon:
    image: mockoon/cli:latest
    command: mockoon-cli start
    networks:
      demo:
    ports:
      - "8001:8001"
    volumes:
      - type: bind
        source: ./mock.json
        target: /www
networks:
  demo:

when i run docker-compose up the container comes up for few seconds and shuts down with the following log

 ›   Error: Missing required flag:
 ›    -d, --data DATA  Path(s) or URL(s) to your Mockoon data file(s)
 ›   See more help with --help

Any additional settings that i should make or i have missed something in my config.


Solution

  • I have checked the official documentation, you need to specify the --data directory inside the docker-compose command line.

    So the compose file would like like this:

    
    version: "3"
    services:
      mockoon:
        image: mockoon/cli:latest
        command: mockoon-cli start  --data <directory> # this is where the change takes place
        networks:
          demo:
        ports:
          - "8001:8001"
        volumes:
          - type: bind
            source: ./mock.json
            target: /www
    networks:
      demo:
    

    mockoon cli