Skip to content

Commit ef1c48a

Browse files
Improve CI debugging: show container logs and status
Enhance the CI pipeline by adding steps to display Docker container logs and status information. Output recent log lines after MongoDB and app startup retries, and show full logs and container status before removal. These changes aid troubleshooting of container and application startup issues.
1 parent 26d66fc commit ef1c48a

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

.github/workflows/docker-image-pr.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ jobs:
2525
for i in {1..10}; do
2626
nc -z localhost 27017 && echo "MongoDB is up" && break
2727
echo "Retrying in 3 seconds..."
28+
echo "Container logs:"
29+
docker logs grandnode2-container --tail 20
2830
sleep 3
2931
done
3032
@@ -79,11 +81,20 @@ jobs:
7981
else
8082
echo "Received HTTP response code: $RESPONSE. Retrying in 3 seconds..."
8183
fi
84+
echo "Container logs:"
85+
docker logs grandnode2-container --tail 30
8286
sleep 3
8387
done
8488
echo "Application did not start successfully. Final response code: $RESPONSE"
8589
exit 1
86-
90+
91+
- name: Show container logs
92+
run: |
93+
echo "=== Full container logs ==="
94+
docker logs grandnode2-container
95+
echo "=== Container status ==="
96+
docker inspect grandnode2-container --format='{{.State.Status}} - Exit: {{.State.ExitCode}}'
97+
8798
- name: Stop and remove the container
8899
run: |
89100
docker stop grandnode2-container

0 commit comments

Comments
 (0)