Variable interpolation into .env file

According to what it says here Set, use, and manage variables in a Compose file with interpolation | Docker Docs

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'

Why?

Then it is probably time to use a supported Docker Compose version instead of Compose v1

v1 was discontinued a year ago

$ export LANGUAGE=en

$ sudo apt-get update
Hit:1 https://downloads.plex.tv/repo/deb public InRelease
Hit:2 http://it.archive.ubuntu.com/ubuntu jammy InRelease
Hit:3 http://it.archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:4 http://it.archive.ubuntu.com/ubuntu jammy-backports InRelease
Hit:5 http://security.ubuntu.com/ubuntu jammy-security InRelease
Reading package lists... Done

$ sudo apt-get install docker-compose-plugin
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package docker-compose-plugin

Overview of installing Docker Compose (doc)

ok this method works

But because the more conventional (more comfortable) one doesn’t work

$ sudo apt-get install docker-compose-plugin
...
E: Unable to locate package docker-compose-plugin

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.

First of all

$ 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.

Are you sure that it is appropriate to proceed?

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

 1998  for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done
blabla...
 2000  sudo apt-get update
blabla...
 2001  sudo apt-get install ca-certificates curl
blabla...
 2002  sudo install -m 0755 -d /etc/apt/keyrings
blabla...
 2003  sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
blabla...
 2004  sudo chmod a+r /etc/apt/keyrings/docker.asc
 2006  echo   "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" |   sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
blabla...
 2007  sudo apt-get update
blabla...
 2008  sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
blabla...
 2009  sudo docker run hello-world
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See 'docker run --help'.

I solved it like this

sudo groupadd -f docker
sudo usermod -aG docker $USER
sudo service docker start