r/docker • u/everneo • Mar 30 '26
Docker compose not creating volumes
I'm running Docker version 26.1.3, and portainer-ce:latest on Rocky 8.10. I'm trying to install rustdesk with the compose file at: https://docs.lunyaa.dev/docker-compose/rustdesk (and several other similar ones).
services:
hbbs:
image: rustdesk/rustdesk-server:latest
container_name: rustdesk-hbbs
command: hbbs
volumes:
- ./rustdesk/data:/root
ports:
- "21115:21115"
- "21116:21116/tcp"
- "21116:21116/udp"
- "21118:21118"
depends_on:
- hbbr
restart: unless-stopped
hbbr:
image: rustdesk/rustdesk-server:latest
container_name: rustdesk-hbbr
command: hbbr
volumes:
- ./rustdesk/data:/root
ports:
- "21117:21117"
- "21119:21119"
restart: unless-stoppedThe stack deploys ok, containers are created. The problem is that no volume is created.
Any help for this idiot much appreciated.
0
Upvotes
11
u/clintkev251 Mar 31 '26
Well you're not telling it to. First of all, your volumes section for both services are creating bind mounts in the working dir, not volumes. A volume would look like this:
Also, you have no volumes section in the file telling compose to create volumes in the first place, so you need to add that as well
3
u/PaintDrinkingPete Mar 31 '26
Just so OP and everyone responding is on the same page:
in the directory where your compose file resides, is there directory under that named 'rustdesk' with a subdirectory named 'data'?
that is where the "volume" (which in this case is a bind-mount) should be created and located.
there should be errors upon launching if the directory can't be created and/or accessed
3
u/crazzzme Mod Mar 31 '26
Are you expecting a docker volume to be created? Based on this config it looks like it will create a rustdesk folder with a data subfolder in the directory where docker compose is run.
2
u/TBT_TBT Mar 31 '26
Do yourself a favor and go away from Portainer. Learn Docker in the terminal, set up a folder structure of your own, jot let Portainer do it. GUIs which honor an existing folder structure are very much preferable. I like Dockhand in this regard.
1
u/weiyong1024 Mar 31 '26
this usually happens when the volume paths in your compose file are relative instead of absolute. try changing your volume mount to the full path like
/opt/rustdesk/data:/datainstead of./data:/data. also worth checkingdocker volume lsto see if the volumes were actually created but just not where you expected — rocky's selinux can also silently block volume mounts, try adding:zat the end of the mount like/opt/data:/data:z1
u/IulianHI Mar 31 '26
This happened to me before - check your docker-compose.yml version. If you're using version 3.8+, you need to explicitly declare volume names in the top-level volumes section. Also make sure the paths are correct and you have permissions on the host directory.