Docker compose creates a new volume instead of attaching existing volume

When I run this docker compose yaml file to create a multi-container app it creates a new volume called algo_trading_algo_data instead of attaching an existing volume called algo_data.
As a result the bot_hl_test2 container fails because it can’t find a file.

If I create a single container bot_hl_test the correct volume (algo_data) is attached and the container works. Any suggestions please?

name: algo_trading

services:
ibeam:
image: voyz/ibeam
container_name: ibeam
env_file:
- ibeam/env.list
ports:
- 127.0.0.1:5000:5000
- 127.0.0.1:5001:5001
network_mode: bridge # Required due to clientportal.gw IP restrictions
restart: ‘no’ # Prevents IBEAM_MAX_FAILED_AUTH from being exceeded

bots:
image: bot_hl_test
volumes:
- algo_data:/var/lib/docker/volumes/algo_data/_data
container_name: bot_hl_test2
depends_on:
- ibeam
networks:
- default

volumes:
algo_data:

networks:
default:
driver: bridge

volume mount on bot_hl_test2 in the multi-container app
“Mounts”: [
{
“Type”: “volume”,
“Source”: “algo_trading_algo_data”,
“Target”: “/var/lib/docker/volumes/algo_data/_data”,
“VolumeOptions”: {}
}
],

volume mount in bot_hl_test single container which works
“Mounts”: [
{
“Type”: “volume”,
“Name”: “algo_data”,
“Source”: “/var/lib/docker/volumes/algo_data/_data”,
“Destination”: “/data”,
“Driver”: “local”,
“Mode”: “z”,
“RW”: true,
“Propagation”: “”
}
],


Please, format your post according to the following guide: How to format your forum posts
In short: please, use </> button to share codes, terminal outputs, error messages or anything that can contain special characters which would be interpreted by the MarkDown filter. Use the preview feature to make sure your text is formatted as you would expect it and check your post after you have sent it so you can still fix it.

Example code block:

```
echo "I am a code."
echo "An athletic one, and I wanna run."
```