I tried this solution and for me works
version: '3.1'
services:
alp:
image: alpine
volumes:
- my-jenkins-volume:/your/local/path
command: sleep 10000
volumes:
my-jenkins-volume:
external: false
external true if you provide your volume from an external source, not directly from the docker-compose spec
Reference with the doc
https://docs.docker.com/compose/compose-file/#volume-configuration-reference