When you execute docker-compose from freestyle step you need to change the way volumes are specified in docker-compose.yaml file.
Because docker-daemon resides on Dind and is shared to the running container, volumes will be searched in relation to the Dind file system.
Root volume shared to the container under `/codefresh/volume` path is constructed using following pattern on the Dind:
var/lib/docker/volumes/$PIPELINE_ID/[${{TRIGGER_ID}}/]_data/[${{CF_REPO_NAME}}]
Use following step to initialize volume name to ${CF_VOLUME_PATH}:
constructCF_VOLUME_NAME:
image: "codefresh/cli"
commands:
- >-
export CF_VOLUME_NAME=$( codefresh get builds $CF_BUILD_ID -o wide --select-columns "pipeline-Id","pipeline-trigger-id" | sed '1d; s/^/pipeline_/; s/ \(\S\+\)/_trigger_\1/; s/ *$//' )
- export CF_VOLUME_PATH=/var/lib/docker/volumes/$CF_VOLUME_NAME/_data/ #${CF_REPO_NAME}
- cf_export CF_VOLUME_PATH=$CF_VOLUME_PATH
and the use it in docker-compose.yaml as:
...
volumes
- ${CF_VOLUME_REPO_PATH}/mounted_dir:/test
that will mount `/codefresh/volume/mounted_dir` under `/test` directory in the container.