coolify icon indicating copy to clipboard operation
coolify copied to clipboard

[Bug]: Post-deployment Command with build server doesn't run command in correct container

Open HarleySalas opened this issue 10 months ago • 2 comments

Description

Post-deployment Command with a build server attempts to run the command in the container that built the image, rather than the resulting deployment, once build is complete.

Minimal Reproduction (if possible, example repository)

You can see that I have a build server, which starts with a container called bsosc0g:

[2024-Apr-23 15:13:27.688987] Found a suitable build server (build-server-1).
[2024-Apr-23 15:13:27.693504] Starting deployment of {{MY_PROJECT}} to localhost.
[2024-Apr-23 15:13:28.969487] Preparing container with helper image: ghcr.io/coollabsio/coolify-helper:latest.
[2024-Apr-23 15:13:30.079937]

[COMMAND] docker pull -q ghcr.io/coollabsio/coolify-helper:latest
[OUTPUT]
ghcr.io/coollabsio/coolify-helper:latest

[2024-Apr-23 15:13:30.273226]

[COMMAND] docker rm -f bsosc0g
[OUTPUT]
Error response from daemon: No such container: bsosc0g

[2024-Apr-23 15:13:30.522770]

[COMMAND] docker run -d --name bsosc0g --rm -v /root/.docker/config.json:/root/.docker/config.json:ro -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/coollabsio/coolify-helper:latest
[OUTPUT]
6d69887f5bba7b0cfc3b9b19a38d047177a657cb38a844b796ae0dae9ba2461d

However, the resulting container on my deployment is j804sw4. You can see that once the container is running healthy, it attempts to run the custom command I've entered, but in the original build container of bs0sc0g instead.

[2024-Apr-23 15:17:42.041144] Attempt 2 of 10 | Healthcheck status: "healthy"
[2024-Apr-23 15:17:42.068444] New container is healthy.
[2024-Apr-23 15:17:42.084085] Removing old containers.
[2024-Apr-23 15:17:42.521205] Rolling update completed.
[2024-Apr-23 15:17:42.592993] Executing post-deployment command (see debug log for output): pnpm migrate
[2024-Apr-23 15:17:43.298125]

[COMMAND] docker exec bsosc0g bash -c 'docker exec j804sw4-151326404827 sh -c "pnpm migrate"'
[OUTPUT]
Error response from daemon: No such container: bsosc0g

[2024-Apr-23 15:17:43.377629] Oops something is not okay, are you okay? 😢

[2024-Apr-23 15:17:43.382794] Error response from daemon: No such container: bsosc0g

[2024-Apr-23 15:17:43.393086] Deployment failed. Removing the new version of your application.

Exception or Error

No response

Version

265

Building with Dockerfile, if it matters; (not Nix)

HarleySalas avatar Apr 23 '24 15:04 HarleySalas

How can i workaround this, currently testing for the first time coolify.

adderly avatar May 12 '24 11:05 adderly

This will be fixed in the upcoming version.

andrasbacsai avatar May 23 '24 11:05 andrasbacsai