Unquoted and double-quoted (" ) values have interpolation applied.
So
$ test -f $HOME/docker-compose.yml && echo File exists
File exists
OK
$ cat .env
COMPOSE_FILE=$HOME/docker-compos.yml
$ docker-compose run --rm xxxx
ERROR: .FileNotFoundError: [Errno 2] No such file or directory: './$HOME/docker-compose.yml'
The best of the best practices is following the documentation to the last letter. If you can’t install the compose plugin, you don’t have the apt repository from Docker. So I wonder how you installed it in the first place.
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.4 LTS
Release: 22.04
Codename: jammy
So following the link you indicated
Note
The latest Ubuntu 24.04 LTS is not yet supported. Docker Desktop will fail to start. Due to a change in how the latest Ubuntu release restricts the unprivileged namespaces, sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 needs to be run at least once. Refer to the Ubuntu Blog for more details.
If you read the text on the website, you can see it just mentions Docker Desktop as well. Ignore those links. The “Supported platforms” section is about Docker Engine. Since now you shared which debian-based distro you use