coolify icon indicating copy to clipboard operation
coolify copied to clipboard

[Bug]: Issue dockerfile build with health check on github apps releases

Open bunyu93 opened this issue 1 year ago • 13 comments

Description

failing docker build with new label when pressed on reset. same docker file works fine on ohter server or local pc with same kernel version of docker host. after verion v4.0.0-beta.294 i had noticed the issue

Minimal Reproduction (if possible, example repository)

used reset labels coolify

Exception or Error

image image doenst startup

Version

v4.0.0-beta.294

bunyu93 avatar Jun 06 '24 15:06 bunyu93

Would be helpful to see the Dockerfile and the Debug Logs (there's an option to activate and see it when Deploying)

LEstradioto avatar Jun 08 '24 16:06 LEstradioto

docker file

FROM node:22-alpine as build
LABEL version="1.0"
LABEL description="Taxi"

WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH

COPY package.json ./
COPY package-lock.json ./
RUN npm install --silent

COPY . ./
RUN npm run build

FROM nginx:stable-alpine as release

RUN apk update && apk add curl

COPY --from=build /app/NGINX/default.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/NGINX/gzip.conf /etc/nginx/conf.d/gzip.conf
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80

HEALTHCHECK  --interval=10s --timeout=3s \
    CMD curl http://localhost:80 || exit 1

CMD ["nginx", "-g", "daemon off;"]

Debug Output

Container y8408w0-073254126524 Started

[2024-Jun-10 07:33:20.208057] New container started.
[2024-Jun-10 07:33:20.211481] Custom healthcheck found, skipping default healthcheck.
[2024-Jun-10 07:33:20.214217] Waiting for healthcheck to pass on the new container.
[2024-Jun-10 07:33:20.216388] Healthcheck URL (inside the container): GET: [http://localhost:80/](http://localhost/)
[2024-Jun-10 07:33:20.218665] Waiting for the start period (5 seconds) before starting healthcheck.
[2024-Jun-10 07:33:25.321938]

[COMMAND] docker inspect --format='{{json .State.Health.Status}}' y8408w0-073254126524
[OUTPUT]
"starting"

[2024-Jun-10 07:33:25.428473]

[COMMAND] docker inspect --format='{{json .State.Health.Log}}' y8408w0-073254126524
[OUTPUT]
[]

[2024-Jun-10 07:33:25.432560] Attempt 1 of 10 | Healthcheck status: "starting"
[2024-Jun-10 07:33:35.546271]

[COMMAND] docker inspect --format='{{json .State.Health.Status}}' y8408w0-073254126524
[OUTPUT]
"starting"

[2024-Jun-10 07:33:35.656397]

[COMMAND] docker inspect --format='{{json .State.Health.Log}}' y8408w0-073254126524
[OUTPUT]
[{"Start":"2024-06-10T09:33:30.198288781+02:00","End":"2024-06-10T09:33:30.26517896+02:00","ExitCode":1,"Output":" % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\ncurl: (7) Failed to connect to localhost port 80 after 0 ms: Couldn't connect to server\n"}]

[2024-Jun-10 07:33:35.660432] Attempt 2 of 10 | Healthcheck status: "starting"
[2024-Jun-10 07:33:35.663479] Healthcheck logs: % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 curl: (7) Failed to connect to localhost port 80 after 0 ms: Couldn't connect to server | Return code: 1
[2024-Jun-10 07:33:45.769958]

[COMMAND] docker inspect --format='{{json .State.Health.Status}}' y8408w0-073254126524
[OUTPUT]
"starting"

[2024-Jun-10 07:33:45.874602]

[COMMAND] docker inspect --format='{{json .State.Health.Log}}' y8408w0-073254126524
[OUTPUT]
[{"Start":"2024-06-10T09:33:30.198288781+02:00","End":"2024-06-10T09:33:30.26517896+02:00","ExitCode":1,"Output":" % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\ncurl: (7) Failed to connect to localhost port 80 after 0 ms: Couldn't connect to server\n"},{"Start":"2024-06-10T09:33:40.266329258+02:00","End":"2024-06-10T09:33:40.331260479+02:00","ExitCode":1,"Output":" % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\ncurl: (7) Failed to connect to localhost port 80 after 0 ms: Couldn't connect to server\n"}]

[2024-Jun-10 07:33:45.877808] Attempt 3 of 10 | Healthcheck status: "starting"
[2024-Jun-10 07:33:45.879780] Healthcheck logs: % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 curl: (7) Failed to connect to localhost port 80 after 0 ms: Couldn't connect to server | Return code: 1
[2024-Jun-10 07:33:55.991327]

[COMMAND] docker inspect --format='{{json .State.Health.Status}}' y8408w0-073254126524
[OUTPUT]
"unhealthy"

[2024-Jun-10 07:33:56.100475]

[COMMAND] docker inspect --format='{{json .State.Health.Log}}' y8408w0-073254126524
[OUTPUT]
[{"Start":"2024-06-10T09:33:30.198288781+02:00","End":"2024-06-10T09:33:30.26517896+02:00","ExitCode":1,"Output":" % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\ncurl: (7) Failed to connect to localhost port 80 after 0 ms: Couldn't connect to server\n"},{"Start":"2024-06-10T09:33:40.266329258+02:00","End":"2024-06-10T09:33:40.331260479+02:00","ExitCode":1,"Output":" % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\ncurl: (7) Failed to connect to localhost port 80 after 0 ms: Couldn't connect to server\n"},{"Start":"2024-06-10T09:33:50.331994083+02:00","End":"2024-06-10T09:33:50.391861621+02:00","ExitCode":1,"Output":" % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\ncurl: (7) Failed to connect to localhost port 80 after 0 ms: Couldn't connect to server\n"}]

[2024-Jun-10 07:33:56.105296] Attempt 4 of 10 | Healthcheck status: "unhealthy"
[2024-Jun-10 07:33:56.108629] Healthcheck logs: % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 curl: (7) Failed to connect to localhost port 80 after 0 ms: Couldn't connect to server | Return code: 1
[2024-Jun-10 07:33:56.111895] ----------------------------------------
[2024-Jun-10 07:33:56.114743] Container logs:
[2024-Jun-10 07:33:56.220785] /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf differs from the packaged version
/docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up

[2024-Jun-10 07:33:56.225193] ----------------------------------------
[2024-Jun-10 07:33:56.228681] Removing old containers.
[2024-Jun-10 07:33:56.231648] ----------------------------------------
[2024-Jun-10 07:33:56.234432] WARNING: Dockerfile or Docker Image based deployment detected. The healthcheck needs a curl or wget command to check the health of the application. Please make sure that it is available in the image or turn off healthcheck on Coolify's UI.
[2024-Jun-10 07:33:56.237719] ----------------------------------------
[2024-Jun-10 07:33:56.240496] New container is not healthy, rolling back to the old container.
[2024-Jun-10 07:33:56.584436] Rolling update completed.

@LEstradioto

bunyu93 avatar Jun 10 '24 07:06 bunyu93

I had the same issue, as health checks seem to be running from the container itself I had to add wget or curl to the docker image.

igor-topolski avatar Jun 10 '24 12:06 igor-topolski

@igor-topolski I have shared mine dockerfile also im including explicit the curl package :)

bunyu93 avatar Jun 10 '24 13:06 bunyu93

Ive tested this minimal setup and it worked

FROM node:22-alpine as build
FROM nginx:stable-alpine as release

RUN apk update && apk add curl

EXPOSE 80

HEALTHCHECK  --interval=10s --timeout=3s \
    CMD curl http://localhost:80 || exit 1

CMD ["nginx", "-g", "daemon off;"]

at your Logs, curl is returning (7) Failed to connect to localhost port 80 after 0 ms: Couldn't connect to server so curl is good, I guess nginx is not reachable? perhaps some nginx custom config?

LEstradioto avatar Jun 11 '24 01:06 LEstradioto

the weird part is when i build it locally then there no issue ??

bunyu93 avatar Jun 11 '24 17:06 bunyu93

If no Nginx problem then I would debug understanding the contet being copied to Docker Image the COPY . ./ can override stuff, thus .dockerignore exists

On my sucessfull minimal deploy I didnt have any of this in my log: docker-entrypoint.sh: /docker-entrypoint.d/ ....

LEstradioto avatar Jun 11 '24 17:06 LEstradioto

I think the problem is there is an issue with path thats chosen to build the image i have used private github repo way there must be an bug there.

when i choose directly dockerfile build en past this one in than it is working correctly

Docker file

FROM node:alpine as build
LABEL version="1.0"
LABEL description="Taxi Secure"

# production environment
FROM nginx:stable-alpine as release

RUN apk update && apk add curl

EXPOSE 80

HEALTHCHECK  --interval=10s --timeout=3s \
    CMD curl http://localhost:80 || exit 1

CMD ["nginx", "-g", "daemon off;"]

Output


Deployment
[Website](https://sakar.cloud/project/h84w4s8)
[production](https://sakar.cloud/project/h84w4s8/production)
Taxi Secure
Exited
[Configuration](https://sakar.cloud/project/h84w4s8/production/application/og8gocs?deployment_uuid=l0c04w0)
[Deployments](https://sakar.cloud/project/h84w4s8/production/application/og8gocs/deployment?deployment_uuid=l0c04w0)
[Logs](https://sakar.cloud/project/h84w4s8/production/application/og8gocs/logs?deployment_uuid=l0c04w0)
[Command](https://sakar.cloud/project/h84w4s8/production/application/og8gocs/command?deployment_uuid=l0c04w0)

Links

Advanced
Deploy
Deployment Log
Hide Debug Logs
Deployment is Failed.

[2024-Jun-11 19:10:42.786394] Starting deployment of bunyu93/TaxiSecure:main to localhost.
[2024-Jun-11 19:10:42.963477] Preparing container with helper image: ghcr.io/coollabsio/coolify-helper:latest.
[2024-Jun-11 19:10:43.060321]

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

[2024-Jun-11 19:10:43.183946]

[COMMAND] docker run -d --network coolify --name l0c04w0 --rm -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/coollabsio/coolify-helper:latest
[OUTPUT]
d342162a88cd64ebdb5bab635e2699da5b0b38307d6ae5da6bfa13e6dbdbc6fb

[2024-Jun-11 19:10:44.577394]

[COMMAND] docker exec l0c04w0 bash -c 'GIT_SSH_COMMAND="ssh -o ConnectTimeout=30 -p 22 -o Port=22 -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" git ls-remote https://x-access-token:<REDACTED>@github.com/bunyu93/TaxiSecure.git main'
[OUTPUT]
c356a6bd3d5e4faaa26b288f914ebf94e2c03d3f refs/heads/main

[2024-Jun-11 19:10:44.843759] ----------------------------------------
[2024-Jun-11 19:10:44.845882] Importing bunyu93/TaxiSecure:main (commit sha HEAD) to /artifacts/l0c04w0.
[2024-Jun-11 19:10:45.016101]

[COMMAND] docker exec l0c04w0 bash -c 'git clone -b "main" https://x-access-token:<REDACTED>@github.com/bunyu93/TaxiSecure.git /artifacts/l0c04w0 && cd /artifacts/l0c04w0 && GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" git submodule update --init --recursive && cd /artifacts/l0c04w0 && GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" git lfs pull'
[OUTPUT]
Cloning into '/artifacts/l0c04w0'...

[2024-Jun-11 19:10:47.575127]

[COMMAND] docker exec l0c04w0 bash -c 'cd /artifacts/l0c04w0 && git log -1 c356a6bd3d5e4faaa26b288f914ebf94e2c03d3f --pretty=%B'
[OUTPUT]
Merge branch 'main' of https://github.com/bunyu93/TaxiSecure
[2024-Jun-11 19:10:48.441940]

[COMMAND] docker exec l0c04w0 bash -c 'cat /artifacts/l0c04w0/Dockerfile'
[OUTPUT]
FROM node:alpine as build
LABEL version="1.0"
LABEL description="Taxi Secure"

# WORKDIR /app
# ENV PATH /app/node_modules/.bin:$PATH

# COPY package.json ./
# RUN npm install --silent

# add app
# COPY . ./
# RUN npm run build

# production environment
FROM nginx:stable-alpine as release

RUN apk update && apk add curl

# COPY --from=build /app/NGINX/default.conf /etc/nginx/conf.d/default.conf
# COPY --from=build /app/NGINX/gzip.conf /etc/nginx/conf.d/gzip.conf
# COPY --from=build /app/dist /usr/share/nginx/html

EXPOSE 80

HEALTHCHECK --interval=10s --timeout=3s \
CMD curl [http://localhost:80](http://localhost/) || exit 1

CMD ["nginx", "-g", "daemon off;"]
[2024-Jun-11 19:10:48.784721]

[COMMAND] docker exec l0c04w0 bash -c 'cat /artifacts/l0c04w0/Dockerfile'
[OUTPUT]
FROM node:alpine as build
LABEL version="1.0"
LABEL description="Taxi Secure"

# WORKDIR /app
# ENV PATH /app/node_modules/.bin:$PATH

# COPY package.json ./
# RUN npm install --silent

# add app
# COPY . ./
# RUN npm run build

# production environment
FROM nginx:stable-alpine as release

RUN apk update && apk add curl

# COPY --from=build /app/NGINX/default.conf /etc/nginx/conf.d/default.conf
# COPY --from=build /app/NGINX/gzip.conf /etc/nginx/conf.d/gzip.conf
# COPY --from=build /app/dist /usr/share/nginx/html

EXPOSE 80

HEALTHCHECK --interval=10s --timeout=3s \
CMD curl [http://localhost:80](http://localhost/) || exit 1

CMD ["nginx", "-g", "daemon off;"]
[2024-Jun-11 19:10:49.001690] ----------------------------------------
[2024-Jun-11 19:10:49.004510] Building docker image started.
[2024-Jun-11 19:10:49.006703] To check the current progress, click on Show Debug Logs.
[2024-Jun-11 19:10:49.658334]

[COMMAND] docker exec l0c04w0 bash -c 'bash /artifacts/build.sh'
[OUTPUT]
#0 building with "default" instance using docker driver

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 691B done
#1 DONE 0.0s

#2 [internal] load metadata for docker.io/library/nginx:stable-alpine
#2 DONE 0.0s

#3 [internal] load .dockerignore
#3 transferring context: 375B done
#3 DONE 0.0s

#4 [release 1/2] FROM docker.io/library/nginx:stable-alpine
#4 CACHED

#5 [release 2/2] RUN apk update && apk add curl
#5 0.071 fetch https://dl-cdn.alpinelinux.org/alpine/v3.19/main/x86_64/APKINDEX.tar.gz
[2024-Jun-11 19:10:49.776453]

[COMMAND] docker exec l0c04w0 bash -c 'bash /artifacts/build.sh'
[OUTPUT]
#5 0.189 fetch https://dl-cdn.alpinelinux.org/alpine/v3.19/community/x86_64/APKINDEX.tar.gz
[2024-Jun-11 19:10:50.205924]

[COMMAND] docker exec l0c04w0 bash -c 'bash /artifacts/build.sh'
[OUTPUT]
#5 0.618 v3.19.1-594-ged051af2627 [https://dl-cdn.alpinelinux.org/alpine/v3.19/main]
#5 0.618 v3.19.1-606-g7b511b0755b [https://dl-cdn.alpinelinux.org/alpine/v3.19/community]
#5 0.618 OK: 23043 distinct packages available
[2024-Jun-11 19:10:50.688463]

[COMMAND] docker exec l0c04w0 bash -c 'bash /artifacts/build.sh'
[OUTPUT]
#5 1.101 OK: 46 MiB in 66 packages

[2024-Jun-11 19:10:50.826114]

[COMMAND] docker exec l0c04w0 bash -c 'bash /artifacts/build.sh'
[OUTPUT]
#5 DONE 1.2s

[2024-Jun-11 19:10:50.870618]

[COMMAND] docker exec l0c04w0 bash -c 'bash /artifacts/build.sh'
[OUTPUT]
#6 exporting to image
#6 exporting layers 0.0s done
#6 writing image sha256:f2a7b3adc759d3c73e337ea66bd7b854499fe61212ceb40acdfb888e0f485191 done
#6 naming to docker.io/library/og8gocs:c356a6bd3d5e4faaa26b288f914ebf94e2c03d3f done
#6 DONE 0.0s

[2024-Jun-11 19:10:50.878620] Building docker image completed.
[2024-Jun-11 19:10:50.882851] ----------------------------------------
[2024-Jun-11 19:10:50.886068] Rolling update started.
[2024-Jun-11 19:10:51.101331]

[COMMAND] docker exec l0c04w0 bash -c 'SOURCE_COMMIT=c356a6bd3d5e4faaa26b288f914ebf94e2c03d3f COOLIFY_FQDN=https://taxisecure.nl/ COOLIFY_URL=taxisecure.nl/ COOLIFY_BRANCH=main docker compose --project-directory /artifacts/l0c04w0 -f /artifacts/l0c04w0/docker-compose.yml up --build -d'
[OUTPUT]
Container og8gocs-191042029477 Creating

[2024-Jun-11 19:10:51.123851]

[COMMAND] docker exec l0c04w0 bash -c 'SOURCE_COMMIT=c356a6bd3d5e4faaa26b288f914ebf94e2c03d3f COOLIFY_FQDN=https://taxisecure.nl/ COOLIFY_URL=taxisecure.nl/ COOLIFY_BRANCH=main docker compose --project-directory /artifacts/l0c04w0 -f /artifacts/l0c04w0/docker-compose.yml up --build -d'
[OUTPUT]
og8gocs-191042029477 Your kernel does not support memory swappiness capabilities or the cgroup is not mounted. Memory swappiness discarded.

[2024-Jun-11 19:10:51.125887]

[COMMAND] docker exec l0c04w0 bash -c 'SOURCE_COMMIT=c356a6bd3d5e4faaa26b288f914ebf94e2c03d3f COOLIFY_FQDN=https://taxisecure.nl/ COOLIFY_URL=taxisecure.nl/ COOLIFY_BRANCH=main docker compose --project-directory /artifacts/l0c04w0 -f /artifacts/l0c04w0/docker-compose.yml up --build -d'
[OUTPUT]
Container og8gocs-191042029477 Created

[2024-Jun-11 19:10:51.127251]

[COMMAND] docker exec l0c04w0 bash -c 'SOURCE_COMMIT=c356a6bd3d5e4faaa26b288f914ebf94e2c03d3f COOLIFY_FQDN=https://taxisecure.nl/ COOLIFY_URL=taxisecure.nl/ COOLIFY_BRANCH=main docker compose --project-directory /artifacts/l0c04w0 -f /artifacts/l0c04w0/docker-compose.yml up --build -d'
[OUTPUT]
Container og8gocs-191042029477 Starting

[2024-Jun-11 19:10:51.356477]

[COMMAND] docker exec l0c04w0 bash -c 'SOURCE_COMMIT=c356a6bd3d5e4faaa26b288f914ebf94e2c03d3f COOLIFY_FQDN=https://taxisecure.nl/ COOLIFY_URL=taxisecure.nl/ COOLIFY_BRANCH=main docker compose --project-directory /artifacts/l0c04w0 -f /artifacts/l0c04w0/docker-compose.yml up --build -d'
[OUTPUT]
Container og8gocs-191042029477 Started

[2024-Jun-11 19:10:51.364427] New container started.
[2024-Jun-11 19:10:51.366996] Custom healthcheck found, skipping default healthcheck.
[2024-Jun-11 19:10:51.370604] Waiting for healthcheck to pass on the new container.
[2024-Jun-11 19:10:51.372896] Healthcheck URL (inside the container): GET: [http://localhost:80/](http://localhost/)
[2024-Jun-11 19:10:51.374415] Waiting for the start period (5 seconds) before starting healthcheck.
[2024-Jun-11 19:10:56.475506]

[COMMAND] docker inspect --format='{{json .State.Health.Status}}' og8gocs-191042029477
[OUTPUT]
"starting"

[2024-Jun-11 19:10:56.579416]

[COMMAND] docker inspect --format='{{json .State.Health.Log}}' og8gocs-191042029477
[OUTPUT]
[]

[2024-Jun-11 19:10:56.582518] Attempt 1 of 10 | Healthcheck status: "starting"
[2024-Jun-11 19:11:06.687660]

[COMMAND] docker inspect --format='{{json .State.Health.Status}}' og8gocs-191042029477
[OUTPUT]
"starting"

[2024-Jun-11 19:11:06.790372]

[COMMAND] docker inspect --format='{{json .State.Health.Log}}' og8gocs-191042029477
[OUTPUT]
[{"Start":"2024-06-11T21:11:01.356190232+02:00","End":"2024-06-11T21:11:01.411083414+02:00","ExitCode":1,"Output":" % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\ncurl: (7) Failed to connect to localhost port 80 after 0 ms: Couldn't connect to server\n"}]

[2024-Jun-11 19:11:06.793762] Attempt 2 of 10 | Healthcheck status: "starting"
[2024-Jun-11 19:11:06.795444] Healthcheck logs: % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 curl: (7) Failed to connect to localhost port 80 after 0 ms: Couldn't connect to server | Return code: 1
[2024-Jun-11 19:11:16.901134]

[COMMAND] docker inspect --format='{{json .State.Health.Status}}' og8gocs-191042029477
[OUTPUT]
"starting"

[2024-Jun-11 19:11:17.004254]

[COMMAND] docker inspect --format='{{json .State.Health.Log}}' og8gocs-191042029477
[OUTPUT]
[{"Start":"2024-06-11T21:11:01.356190232+02:00","End":"2024-06-11T21:11:01.411083414+02:00","ExitCode":1,"Output":" % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\ncurl: (7) Failed to connect to localhost port 80 after 0 ms: Couldn't connect to server\n"},{"Start":"2024-06-11T21:11:11.411856488+02:00","End":"2024-06-11T21:11:11.476015808+02:00","ExitCode":1,"Output":" % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\ncurl: (7) Failed to connect to localhost port 80 after 0 ms: Couldn't connect to server\n"}]

[2024-Jun-11 19:11:17.007889] Attempt 3 of 10 | Healthcheck status: "starting"
[2024-Jun-11 19:11:17.010273] Healthcheck logs: % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 curl: (7) Failed to connect to localhost port 80 after 0 ms: Couldn't connect to server | Return code: 1
[2024-Jun-11 19:11:27.120446]

[COMMAND] docker inspect --format='{{json .State.Health.Status}}' og8gocs-191042029477
[OUTPUT]
"unhealthy"

[2024-Jun-11 19:11:27.229863]

[COMMAND] docker inspect --format='{{json .State.Health.Log}}' og8gocs-191042029477
[OUTPUT]
[{"Start":"2024-06-11T21:11:01.356190232+02:00","End":"2024-06-11T21:11:01.411083414+02:00","ExitCode":1,"Output":" % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\ncurl: (7) Failed to connect to localhost port 80 after 0 ms: Couldn't connect to server\n"},{"Start":"2024-06-11T21:11:11.411856488+02:00","End":"2024-06-11T21:11:11.476015808+02:00","ExitCode":1,"Output":" % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\ncurl: (7) Failed to connect to localhost port 80 after 0 ms: Couldn't connect to server\n"},{"Start":"2024-06-11T21:11:21.477160566+02:00","End":"2024-06-11T21:11:21.548013698+02:00","ExitCode":1,"Output":" % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\ncurl: (7) Failed to connect to localhost port 80 after 0 ms: Couldn't connect to server\n"}]

[2024-Jun-11 19:11:27.233462] Attempt 4 of 10 | Healthcheck status: "unhealthy"
[2024-Jun-11 19:11:27.236065] Healthcheck logs: % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 curl: (7) Failed to connect to localhost port 80 after 0 ms: Couldn't connect to server | Return code: 1
[2024-Jun-11 19:11:27.238721] ----------------------------------------
[2024-Jun-11 19:11:27.241406] Container logs:
[2024-Jun-11 19:11:27.348512] /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up

[2024-Jun-11 19:11:27.352074] ----------------------------------------
[2024-Jun-11 19:11:27.354893] Removing old containers.
[2024-Jun-11 19:11:27.358265] ----------------------------------------
[2024-Jun-11 19:11:27.360708] WARNING: Dockerfile or Docker Image based deployment detected. The healthcheck needs a curl or wget command to check the health of the application. Please make sure that it is available in the image or turn off healthcheck on Coolify's UI.
[2024-Jun-11 19:11:27.363135] ----------------------------------------
[2024-Jun-11 19:11:27.365311] New container is not healthy, rolling back to the old container.
[2024-Jun-11 19:11:27.672753] Rolling update completed.

bunyu93 avatar Jun 11 '24 19:06 bunyu93

There is an bug with docker file build from github apps from repos.

when i used nixbuild everthing works correctly

@LEstradioto @igor-topolski

bunyu93 avatar Jun 12 '24 10:06 bunyu93

When deploying Nixpacks seems to show off a Log with its config at Coolify Debug. And perhaps we could understand what happened reading Nixpacks auto-generated files. After deploy, somewhere in your container there is theses files:

image

We could read the nixpacks Dockerfile or docker-compose and try to debug better

LEstradioto avatar Jun 12 '24 14:06 LEstradioto

I'm having a similar or same issue with two of my projects using the Dockerfile. The health check seems to do whatever it wants.

I have set HEALTCHECK NONE in the Dockerfile, yet coolify attempts to do a check on its own (and fails ofc.)

v4.0.0-beta.300

[2024-Jun-26 12:26:32.945286]

[COMMAND] docker exec qw0koow bash -c 'cat /artifacts/qw0koow/Dockerfile'
[OUTPUT]
FROM oven/bun AS base

# Install dependencies only when needed
FROM base AS deps

WORKDIR /app

# Install dependencies
COPY package.json bun.lockb ./
RUN bun install --frozen-lockfile

# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .

# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Disable telemetry during the build
ENV NEXT_TELEMETRY_DISABLED 1

# use local variables as production (needed when testing locally)
RUN mv -n .env.local .env.production || true

RUN bun run build

# Production image, copy all the files and run next
FROM base AS runner
WORKDIR /app

ENV NODE_ENV production

# Disable telemetry
ENV NEXT_TELEMETRY_DISABLED 1

RUN adduser --system --uid 1001 nextjs

COPY --from=builder /app/public ./public

# Set the correct permission for prerender cache
RUN mkdir .next
RUN chown nextjs:bun .next

# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs:bun /app/.next/standalone ./
COPY --from=builder --chown=nextjs:bun /app/.next/static ./.next/static

USER nextjs

EXPOSE 3000

ENV PORT 3000

# Set hostname to localhost
ENV HOSTNAME "0.0.0.0"

HEALTHCHECK NONE

CMD ["bun", "server.js"]
[2024-Jun-26 12:26:33.125476] ----------------------------------------
[2024-Jun-26 12:26:33.129359] Rolling update started.
[2024-Jun-26 12:26:33.388143]

[COMMAND] docker exec qw0koow bash -c 'SOURCE_COMMIT=68453f4b7f759aeec117b47b1cc708d8663ff39b COOLIFY_FQDN=https://vcm.terijaki.eu COOLIFY_URL=vcm.terijaki.eu COOLIFY_BRANCH=terijaki/issue178 docker compose --project-directory /artifacts/qw0koow -f /artifacts/qw0koow/docker-compose.yml up --build -d'
[OUTPUT] Container js8c0s8-122444822458 Creating  
[2024-Jun-26 12:26:33.669519]

[COMMAND] docker exec qw0koow bash -c 'SOURCE_COMMIT=68453f4b7f759aeec117b47b1cc708d8663ff39b COOLIFY_FQDN=https://vcm.terijaki.eu COOLIFY_URL=vcm.terijaki.eu COOLIFY_BRANCH=terijaki/issue178 docker compose --project-directory /artifacts/qw0koow -f /artifacts/qw0koow/docker-compose.yml up --build -d'
[OUTPUT] js8c0s8-122444822458 Your kernel does not support memory swappiness capabilities or the cgroup is not mounted. Memory swappiness discarded.  
[2024-Jun-26 12:26:33.673365]

[COMMAND] docker exec qw0koow bash -c 'SOURCE_COMMIT=68453f4b7f759aeec117b47b1cc708d8663ff39b COOLIFY_FQDN=https://vcm.terijaki.eu COOLIFY_URL=vcm.terijaki.eu COOLIFY_BRANCH=terijaki/issue178 docker compose --project-directory /artifacts/qw0koow -f /artifacts/qw0koow/docker-compose.yml up --build -d'
[OUTPUT] Container js8c0s8-122444822458 Created  
[2024-Jun-26 12:26:33.676655]

[COMMAND] docker exec qw0koow bash -c 'SOURCE_COMMIT=68453f4b7f759aeec117b47b1cc708d8663ff39b COOLIFY_FQDN=https://vcm.terijaki.eu COOLIFY_URL=vcm.terijaki.eu COOLIFY_BRANCH=terijaki/issue178 docker compose --project-directory /artifacts/qw0koow -f /artifacts/qw0koow/docker-compose.yml up --build -d'
[OUTPUT] Container js8c0s8-122444822458 Starting  
[2024-Jun-26 12:26:33.883964]

[COMMAND] docker exec qw0koow bash -c 'SOURCE_COMMIT=68453f4b7f759aeec117b47b1cc708d8663ff39b COOLIFY_FQDN=https://vcm.terijaki.eu COOLIFY_URL=vcm.terijaki.eu COOLIFY_BRANCH=terijaki/issue178 docker compose --project-directory /artifacts/qw0koow -f /artifacts/qw0koow/docker-compose.yml up --build -d'
[OUTPUT] Container js8c0s8-122444822458 Started  
[2024-Jun-26 12:26:33.897959] New container started.
[2024-Jun-26 12:26:33.905075] Custom healthcheck found, skipping default healthcheck.
[2024-Jun-26 12:26:33.911382] Waiting for healthcheck to pass on the new container.
[2024-Jun-26 12:26:33.916036] Healthcheck URL (inside the container): GET: http://localhost:3000/
[2024-Jun-26 12:26:33.919122] Waiting for the start period (5 seconds) before starting healthcheck.
[2024-Jun-26 12:26:39.026196]

[COMMAND] docker inspect --format='{{json .State.Health.Status}}' js8c0s8-122444822458
[OUTPUT]   
[2024-Jun-26 12:26:39.031854]

[COMMAND] docker inspect --format='{{json .State.Health.Status}}' js8c0s8-122444822458
[OUTPUT] template parsing error: template: :1:13: executing "" at <.State.Health.Status>: map has no entry for key "Health"  
[2024-Jun-26 12:26:39.095441] Oops something is not okay, are you okay? 😢  
[2024-Jun-26 12:26:39.099116] template parsing error: template: :1:13: executing "" at <.State.Health.Status>: map has no entry for key "Health"  
[2024-Jun-26 12:26:39.103698] Deployment failed. Removing the new version of your application. 

terijaki avatar Jun 26 '24 12:06 terijaki

@terijaki and found any solution ?

bunyu93 avatar Jun 27 '24 16:06 bunyu93

@bunyu93 not a fully reproducible solution but I’ve noticed that after playing with some port configurations the health check in my Dockerfile is no longer being ignored.

I’m still observing the behaviour.

Try adjusting Ports exposed and port mapping.

terijaki avatar Jun 28 '24 05:06 terijaki

Same issue here and no luck with changing ports

herkulano avatar Jul 16 '24 13:07 herkulano

@andrasbacsai any fixes or suggested work around?

bunyu93 avatar Jul 30 '24 14:07 bunyu93

A workaround would be to disable health check or add curl/wget to your docker image.

But when Im back from vacation (next Monday) I will take a look deeper.

andrasbacsai avatar Jul 30 '24 20:07 andrasbacsai

I get this even though I manually do RUN apk add curl 🤔

Image

wottpal avatar Nov 17 '24 14:11 wottpal

I also added RUN apk add curl in the Dockerfile and I still have the same error. (v4.0.0-beta.370)

Image

Goodosky avatar Dec 01 '24 05:12 Goodosky

Any news? Still experiencing the issue with Coolify v4.0.0-beta.418

nank1ro avatar May 21 '25 10:05 nank1ro