Deployment error
Failed to deploy a stack: time="2024-10-20T14:07:55Z" level=warning msg="The \"PWD\" variable is not set. Defaulting to a blank string." time="2024-10-20T14:07:55Z" level=warning msg="The \"PWD\" variable is not set. Defaulting to a blank string." time="2024-10-20T14:07:55Z" level=warning msg="/data/compose/2/v1/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion" failed to solve: failed to read dockerfile: open /var/snap/docker/common/var-lib-docker/tmp/buildkit-mount840726655/Dockerfile: no such file or directory
Interesting. My first though was “they must have a .env file in the Git Repo that provides the variable value”, but it’s not the case.
Replace all ${PWD} occurrences with . in the compose file to store the data relative to the location of the compose file. Of course, you can specify absolute paths as well. As an alternative you could use a named volume instead.
PWD exists on linux, but not in the Portainer context. Using a dot would probably not help. If you want to use Portainer for creating containers and not just browsing (which I would recommend) then you have to do things differently. The Portainer way. Like using absolute path to the config files on the host or using configs which you can create in Portainer and then mount it as a volume. but I’m not a Portainer user so I can’t tell you the exact solution using a Portainer GUI, but I’m sure you can find it in the Portainer documentation or in a Portainer forum.
By the way the compose file also tries to define a json file as a volume which is not possible. That is why you need a config definition, not a volume.
Failed to deploy a stack: failed to solve: failed to read dockerfile: open /var/snap/docker/common/var-lib-docker/tmp/buildkit-mount952676191/Dockerfile: no such file or directory
Note: you need to make sure Portainer actually knows about the absolute path you want to use. Lets assume all your volumes are located under /opt/docker/data, then you would need to map this path into the container at the same path.
I don’t use Portainer either, but I know that when Portainer deploys a compose project (called stack in Portainer), the Portainer conatiner must be able to access the path using the same path, otherwise the deployment will fail due to unknown paths.
I second @rimelek’s view about using Portainer to only view thing. Especially beginners won’t understand why voluem mappings won’t work, even though they exist on the host (but haven’t been mapped to the Portainer container).