Docker-compose file that works for others, does NOT want to run

Hi there,

I’ve spent hours and hours trying to troubleshoot this docker-compose yaml file without any luck.

I’m running docker-compose version 1.29.2 on linux mint, if it’s helpful.

I’ve run most of my other containers using portainer, either manually entering container variables or using stacks as a ‘pseudo’ docker-compose (at least that’s my understanding). I have scripted and Plex containers. As far as what relates to this current project, I have a qbittorrent container successfully running, and a gluetun container running with my vpn and port forwarding as well.

However, I’ve tried to execute this docker-compose yaml that will help my gluetun vpn (protonvpn) talk to qbittorrent to update the port, and CANNOT figure it out. I tried first in portioner, using stacks and repeatedly received errors that several variables in the file ‘must be a mapping’ and gave up. I since learned about mapping volumes and I (think) I’m beginning to understand this enough to run a docker-compose of this yaml (which I stored under documents, in a new docker compose folder), but now I’m getting 'unsupported config option for (my container name): ‘depends on’ or the same for ‘network mode’ etc. I have ran the yaml through the Best YAML Formatter Online: Advance YAML Formatter and it doesn’t seem to help.

Here’s the original yaml (I’m using the ‘qbittorrent-natmap’ service as it’s own container):
qbittorrent natmap.

I’ve configured it with named volume mapping, since I’m not sure if the original yaml will mount the volume correctly? see my reply below with how I’ve set it up

Unfortunately this doesn’t work either… I’ve run it through various YAML editors that say it’s valid, then I just get the same errors. I’m not sure why this would work for others, and not my host. I’ve really tried to do my own homework before asking here. I’ve seen most of these issues appear to be fixed with simple syntax issues, but with the yaml validators, I’m feeling this is less likely the issue.

Anyone able to help? I’m stuck and I’d really appreciate advice!

Here’s how I had it set up (though I also tried the identical formatting of the original yaml file without success either–same errors – "unsupported config with ‘network mode’ or ‘depends on’ cited as the issue; when using in stacks, the ‘must be a mapping’ error cited just bout every variable in the file (environment, container_name, etc.):

services:
   container_name: qbittorrent_natmap
   image: ghcr.io/soxfor/qbittorrent-natmap:latest
   environment:
     QBITTORRENT_SERVER=10.2.0.2
     QBITTORRENT_PASS=YbNgQnLyf6
     VPN_GATEWAY=10.2.0.1
   volumes:
     qb_natmap:/var/run/docker.sock:ro
   network_mode: container:gluetun
   depends_on:
     gluetun:
        condition: service_healthy
     qbittorrent: 
        condition: service_started
   restart: unless-stopped
volumes:
   qb_natmap:
     driver:local

Just because it is a valid yaml, it is not a valid docker compose file so I’m pretty sure it couldn’t work for anyone.

  1. You have no service name so what service do you want to set a container name for and everything else?
  2. Your environment section is a string. You either have to start all lines with a dash or use colons instead of equal signs and also have a space after the colons (even in the volumes section after driver:, but you can completely remove that line as that is the default.
  3. The dash character is missing before the volume definition too which can’t be converted too.