Setting a service image, and any compose update, on an existing deployment fails validation when the compose uses a relative env_file such as ./.env, returning invalid compose: env file ./.env not found: stat ./.env: no such file or directory, even though the file exists in the deployment directory. Bringing the deployment up works because that path runs compose from the deployment directory, while validation hardcodes the working directory to . (the agent's own directory), so the relative path resolves against the wrong place. Only env_file triggers it: the loader reads it at parse time, while bind-mount volumes referencing the same ./.env are never checked, so the bug stayed latent until a service used env_file.
validateComposeWithComposeGo sets WorkingDir: ".", and validateComposeContent discards the deployment name it receives, so the update and compose-mount handlers pass the name but validation never learns which directory to resolve against.
Checklist
Related
Setting a service image, and any compose update, on an existing deployment fails validation when the compose uses a relative
env_filesuch as./.env, returninginvalid compose: env file ./.env not found: stat ./.env: no such file or directory, even though the file exists in the deployment directory. Bringing the deploymentupworks because that path runs compose from the deployment directory, while validation hardcodes the working directory to.(the agent's own directory), so the relative path resolves against the wrong place. Onlyenv_filetriggers it: the loader reads it at parse time, while bind-mount volumes referencing the same./.envare never checked, so the bug stayed latent until a service usedenv_file.validateComposeWithComposeGosetsWorkingDir: ".", andvalidateComposeContentdiscards the deployment name it receives, so the update and compose-mount handlers pass the name but validation never learns which directory to resolve against.Checklist
env_fileexists in the deployment directoryRelated