services: sample: image: alpine init: true command: sleep infinity volumes: - data:/data pre_stop: - command: sh -c 'echo "In the pre-stop" >> /data/log.txt' test: image: alpine init: true command: sleep infinity post_start: - command: sh -c 'echo env' volumes: data: