Mounting volume where host directory is different on CI server

Hi,

I’m encountering a problem and I’m not sure how to solve it. I have a docker compose file that mounts a volume from the host to the container. When running docker-compose up locally, the path on the host will always be the same. However, when running docker-compose up from the Continuous Integration (CI) server, the path is different.

For example, the docker-compose has the following

volumes:
  - ${HOME}/directory:/root/directory

I want to have the following when docker-compose is run on the CI server

volumes:
  - ${ANOTHER_VARIABLE}/mydir:/root/directory

I really don’t want to have two docker-compose.yml files. Does anyone have any ideas how to address this?

See Mounting volume where host directory is different on CI server for the discussion.

Could the value of the two variables be made the same?

If that was the case, I wouldn’t be posting this question :slight_smile: Unfortunately, it’s not possible for the values to be the same.