services:
  sample:
    image: nginx
    volumes:
      - data:/data
    pre_stop:
      - command: sh -c 'echo "In the pre-stop" >> /data/log.txt'
volumes:
  data:
    name: sample-data