1
0
Fork 0
mirror of https://github.com/louislam/dockge.git synced 2026-03-03 02:06:55 -05:00

Label shows "exited" if one container has exited but rest is running #1

Closed
opened 2026-02-20 13:09:11 -05:00 by deekerman · 1 comment
Owner

Originally created by @ToshY on GitHub (Nov 12, 2023).

Problem

If a stack has multiple containers, of which the one of the containers (purposely and knowingly) exits, the UI shows that the entire stack has exited.

image

Reproduction

Directory structure

collection/
├── dockge/
│   └── compose.yaml
└── kuma/
    └── compose.yaml
./collection/dockge/compose.yaml
version: '3.9'

x-restart: &restart-always
  restart: always

services:
  dockge:
    image: louislam/dockge:${DOCKGE_IMAGE_VERSION}
    <<: [*restart-always]
    security_opt:
      - no-new-privileges:true
    environment:
      DOCKGE_STACKS_DIR: ${DOCKGE_STACKS_DIR_CONTAINER:-/opt/stacks}
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - dockge:/app/data
      - ${DOCKGE_STACKS_DIR_HOST:-/opt/stacks}:${DOCKGE_STACKS_DIR_CONTAINER:-/opt/stacks}
    networks:
      - dockge
      - proxy

volumes:
  dockge:
    driver: local

networks:
  dockge:
    driver: bridge
  proxy:
    external: true
./collection/dockge/.env
DOCKGE_IMAGE_VERSION="1"
DOCKGE_STACKS_DIR_HOST="../" # resolves to "./collection" on host
DOCKGE_STACKS_DIR_CONTAINER=
./collection/kuma/compose.yaml
version: '3.9'

x-restart: &restart-always
  restart: always

services:
  uptime-kuma:
    image: louislam/uptime-kuma:${UPTIME_KUMA_IMAGE_VERSION}
    <<: [*restart-always]
    security_opt:
      - no-new-privileges:true
    volumes:
      - uptime_kuma:/app/data
    networks:
      - uptime-kuma
      - proxy

  wait:
    image: waisbrot/wait
    environment:
      TARGETS: uptime-kuma:3001
      TIMEOUT: 30
    networks:
      - uptime-kuma

volumes:
  uptime_kuma:
    driver: local

networks:
  uptime-kuma:
    driver: bridge
  proxy:
    external: true
./collection/kuma/.env
UPTIME_KUMA_IMAGE_VERSION="1"
$ docker compose logs -ft
kuma-uptime-kuma-1  | 2023-11-12T16:12:34.607124969Z ==> Performing startup jobs and maintenance tasks
kuma-uptime-kuma-1  | 2023-11-12T16:12:34.607674548Z ==> Starting application with user 0 group 0
kuma-uptime-kuma-1  | 2023-11-12T16:12:34.644486738Z Welcome to Uptime Kuma
kuma-uptime-kuma-1  | 2023-11-12T16:12:34.652094388Z Your Node.js version: 16.20.2
kuma-uptime-kuma-1  | 2023-11-12T16:12:34.689036563Z 2023-11-12T16:12:34Z [SERVER] INFO: Welcome to Uptime Kuma
kuma-uptime-kuma-1  | 2023-11-12T16:12:34.690065180Z 2023-11-12T16:12:34Z [SERVER] INFO: Node Env: production
kuma-uptime-kuma-1  | 2023-11-12T16:12:34.690514441Z 2023-11-12T16:12:34Z [SERVER] INFO: Inside Container: true
kuma-uptime-kuma-1  | 2023-11-12T16:12:34.690963362Z 2023-11-12T16:12:34Z [SERVER] INFO: Importing Node libraries
kuma-uptime-kuma-1  | 2023-11-12T16:12:34.691445555Z 2023-11-12T16:12:34Z [SERVER] INFO: Importing 3rd-party libraries
kuma-uptime-kuma-1  | 2023-11-12T16:12:35.607024282Z 2023-11-12T16:12:35Z [SERVER] INFO: Creating express and socket.io instance
kuma-uptime-kuma-1  | 2023-11-12T16:12:35.607921482Z 2023-11-12T16:12:35Z [SERVER] INFO: Server Type: HTTP
kuma-uptime-kuma-1  | 2023-11-12T16:12:35.609980042Z 2023-11-12T16:12:35Z [SERVER] INFO: Importing this project modules
kuma-uptime-kuma-1  | 2023-11-12T16:12:35.694761652Z 2023-11-12T16:12:35Z [NOTIFICATION] INFO: Prepare Notification Providers
kuma-uptime-kuma-1  | 2023-11-12T16:12:35.700526247Z 2023-11-12T16:12:35Z [SERVER] INFO: Version: 1.23.3
kuma-uptime-kuma-1  | 2023-11-12T16:12:35.746112357Z 2023-11-12T16:12:35Z [DB] INFO: Data Dir: ./data/
kuma-uptime-kuma-1  | 2023-11-12T16:12:35.746473839Z 2023-11-12T16:12:35Z [SERVER] INFO: Connecting to the Database
kuma-uptime-kuma-1  | 2023-11-12T16:12:35.798819111Z 2023-11-12T16:12:35Z [DB] INFO: SQLite config:
kuma-uptime-kuma-1  | 2023-11-12T16:12:35.800552698Z [ { journal_mode: 'wal' } ]
kuma-uptime-kuma-1  | 2023-11-12T16:12:35.801273238Z [ { cache_size: -12000 } ]
kuma-uptime-kuma-1  | 2023-11-12T16:12:35.803553148Z 2023-11-12T16:12:35Z [DB] INFO: SQLite Version: 3.41.1
kuma-uptime-kuma-1  | 2023-11-12T16:12:35.803847930Z 2023-11-12T16:12:35Z [SERVER] INFO: Connected
kuma-uptime-kuma-1  | 2023-11-12T16:12:35.805342508Z 2023-11-12T16:12:35Z [DB] INFO: Your database version: 10
kuma-uptime-kuma-1  | 2023-11-12T16:12:35.805642600Z 2023-11-12T16:12:35Z [DB] INFO: Latest database version: 10
kuma-uptime-kuma-1  | 2023-11-12T16:12:35.805961989Z 2023-11-12T16:12:35Z [DB] INFO: Database patch not needed
kuma-uptime-kuma-1  | 2023-11-12T16:12:35.806302656Z 2023-11-12T16:12:35Z [DB] INFO: Database Patch 2.0 Process
kuma-uptime-kuma-1  | 2023-11-12T16:12:35.822781063Z 2023-11-12T16:12:35Z [SERVER] INFO: Load JWT secret from database.
kuma-uptime-kuma-1  | 2023-11-12T16:12:35.823603669Z 2023-11-12T16:12:35Z [SERVER] INFO: No user, need setup
kuma-uptime-kuma-1  | 2023-11-12T16:12:35.829144935Z 2023-11-12T16:12:35Z [SERVER] INFO: Adding route
kuma-uptime-kuma-1  | 2023-11-12T16:12:35.851198407Z 2023-11-12T16:12:35Z [SERVER] INFO: Adding socket handler
kuma-uptime-kuma-1  | 2023-11-12T16:12:35.851508783Z 2023-11-12T16:12:35Z [SERVER] INFO: Init the server
kuma-uptime-kuma-1  | 2023-11-12T16:12:35.858831837Z 2023-11-12T16:12:35Z [SERVER] INFO: Listening on 3001
kuma-uptime-kuma-1  | 2023-11-12T16:12:35.860040715Z 2023-11-12T16:12:35Z [SERVICES] INFO: Starting nscd
kuma-wait-1         | 2023-11-12T16:12:36.307856735Z Waiting for uptime-kuma:3001  ..  up!
kuma-wait-1         | 2023-11-12T16:12:36.307896810Z Everything is up
kuma-wait-1 exited with code 0

Looking at stack.ts, I see it performs a statusConvert which checks if the status string starts with exited.

So I ran the following command in the stacks directory to see the status of the kuma stack.

$ docker compose ls --all --format json | jq '.[] | select(.Name == "kuma")'

{
  "Name": "kuma",
  "Status": "exited(1), running(1)",
  "ConfigFiles": "./collection/kuma/compose.yaml"
}

It has multiple statuses because one of the containers has exited, and the other one still running.

Possible solution

Maybe instead of startsWith try with includes(?)

Originally created by @ToshY on GitHub (Nov 12, 2023). **Problem** If a stack has multiple containers, of which the one of the containers (purposely and knowingly) exits, the UI shows that the entire stack has exited. ![image](https://github.com/louislam/dockge/assets/31921460/7f2b7d50-f34c-4b80-9108-0b4e5d436774) **Reproduction** Directory structure ```text collection/ ├── dockge/ │ └── compose.yaml └── kuma/ └── compose.yaml ``` <details><summary><code>./collection/dockge/compose.yaml</code></summary> ```yaml version: '3.9' x-restart: &restart-always restart: always services: dockge: image: louislam/dockge:${DOCKGE_IMAGE_VERSION} <<: [*restart-always] security_opt: - no-new-privileges:true environment: DOCKGE_STACKS_DIR: ${DOCKGE_STACKS_DIR_CONTAINER:-/opt/stacks} volumes: - /var/run/docker.sock:/var/run/docker.sock - dockge:/app/data - ${DOCKGE_STACKS_DIR_HOST:-/opt/stacks}:${DOCKGE_STACKS_DIR_CONTAINER:-/opt/stacks} networks: - dockge - proxy volumes: dockge: driver: local networks: dockge: driver: bridge proxy: external: true ``` </details> <details><summary><code>./collection/dockge/.env</code></summary> ```dotenv DOCKGE_IMAGE_VERSION="1" DOCKGE_STACKS_DIR_HOST="../" # resolves to "./collection" on host DOCKGE_STACKS_DIR_CONTAINER= ``` </details> <details><summary><code>./collection/kuma/compose.yaml</code></summary> ```yaml version: '3.9' x-restart: &restart-always restart: always services: uptime-kuma: image: louislam/uptime-kuma:${UPTIME_KUMA_IMAGE_VERSION} <<: [*restart-always] security_opt: - no-new-privileges:true volumes: - uptime_kuma:/app/data networks: - uptime-kuma - proxy wait: image: waisbrot/wait environment: TARGETS: uptime-kuma:3001 TIMEOUT: 30 networks: - uptime-kuma volumes: uptime_kuma: driver: local networks: uptime-kuma: driver: bridge proxy: external: true ``` </details> <details><summary><code>./collection/kuma/.env</code></summary> ```dotenv UPTIME_KUMA_IMAGE_VERSION="1" ``` </details> <details><summary><code>$ docker compose logs -ft</code></summary> ```shell kuma-uptime-kuma-1 | 2023-11-12T16:12:34.607124969Z ==> Performing startup jobs and maintenance tasks kuma-uptime-kuma-1 | 2023-11-12T16:12:34.607674548Z ==> Starting application with user 0 group 0 kuma-uptime-kuma-1 | 2023-11-12T16:12:34.644486738Z Welcome to Uptime Kuma kuma-uptime-kuma-1 | 2023-11-12T16:12:34.652094388Z Your Node.js version: 16.20.2 kuma-uptime-kuma-1 | 2023-11-12T16:12:34.689036563Z 2023-11-12T16:12:34Z [SERVER] INFO: Welcome to Uptime Kuma kuma-uptime-kuma-1 | 2023-11-12T16:12:34.690065180Z 2023-11-12T16:12:34Z [SERVER] INFO: Node Env: production kuma-uptime-kuma-1 | 2023-11-12T16:12:34.690514441Z 2023-11-12T16:12:34Z [SERVER] INFO: Inside Container: true kuma-uptime-kuma-1 | 2023-11-12T16:12:34.690963362Z 2023-11-12T16:12:34Z [SERVER] INFO: Importing Node libraries kuma-uptime-kuma-1 | 2023-11-12T16:12:34.691445555Z 2023-11-12T16:12:34Z [SERVER] INFO: Importing 3rd-party libraries kuma-uptime-kuma-1 | 2023-11-12T16:12:35.607024282Z 2023-11-12T16:12:35Z [SERVER] INFO: Creating express and socket.io instance kuma-uptime-kuma-1 | 2023-11-12T16:12:35.607921482Z 2023-11-12T16:12:35Z [SERVER] INFO: Server Type: HTTP kuma-uptime-kuma-1 | 2023-11-12T16:12:35.609980042Z 2023-11-12T16:12:35Z [SERVER] INFO: Importing this project modules kuma-uptime-kuma-1 | 2023-11-12T16:12:35.694761652Z 2023-11-12T16:12:35Z [NOTIFICATION] INFO: Prepare Notification Providers kuma-uptime-kuma-1 | 2023-11-12T16:12:35.700526247Z 2023-11-12T16:12:35Z [SERVER] INFO: Version: 1.23.3 kuma-uptime-kuma-1 | 2023-11-12T16:12:35.746112357Z 2023-11-12T16:12:35Z [DB] INFO: Data Dir: ./data/ kuma-uptime-kuma-1 | 2023-11-12T16:12:35.746473839Z 2023-11-12T16:12:35Z [SERVER] INFO: Connecting to the Database kuma-uptime-kuma-1 | 2023-11-12T16:12:35.798819111Z 2023-11-12T16:12:35Z [DB] INFO: SQLite config: kuma-uptime-kuma-1 | 2023-11-12T16:12:35.800552698Z [ { journal_mode: 'wal' } ] kuma-uptime-kuma-1 | 2023-11-12T16:12:35.801273238Z [ { cache_size: -12000 } ] kuma-uptime-kuma-1 | 2023-11-12T16:12:35.803553148Z 2023-11-12T16:12:35Z [DB] INFO: SQLite Version: 3.41.1 kuma-uptime-kuma-1 | 2023-11-12T16:12:35.803847930Z 2023-11-12T16:12:35Z [SERVER] INFO: Connected kuma-uptime-kuma-1 | 2023-11-12T16:12:35.805342508Z 2023-11-12T16:12:35Z [DB] INFO: Your database version: 10 kuma-uptime-kuma-1 | 2023-11-12T16:12:35.805642600Z 2023-11-12T16:12:35Z [DB] INFO: Latest database version: 10 kuma-uptime-kuma-1 | 2023-11-12T16:12:35.805961989Z 2023-11-12T16:12:35Z [DB] INFO: Database patch not needed kuma-uptime-kuma-1 | 2023-11-12T16:12:35.806302656Z 2023-11-12T16:12:35Z [DB] INFO: Database Patch 2.0 Process kuma-uptime-kuma-1 | 2023-11-12T16:12:35.822781063Z 2023-11-12T16:12:35Z [SERVER] INFO: Load JWT secret from database. kuma-uptime-kuma-1 | 2023-11-12T16:12:35.823603669Z 2023-11-12T16:12:35Z [SERVER] INFO: No user, need setup kuma-uptime-kuma-1 | 2023-11-12T16:12:35.829144935Z 2023-11-12T16:12:35Z [SERVER] INFO: Adding route kuma-uptime-kuma-1 | 2023-11-12T16:12:35.851198407Z 2023-11-12T16:12:35Z [SERVER] INFO: Adding socket handler kuma-uptime-kuma-1 | 2023-11-12T16:12:35.851508783Z 2023-11-12T16:12:35Z [SERVER] INFO: Init the server kuma-uptime-kuma-1 | 2023-11-12T16:12:35.858831837Z 2023-11-12T16:12:35Z [SERVER] INFO: Listening on 3001 kuma-uptime-kuma-1 | 2023-11-12T16:12:35.860040715Z 2023-11-12T16:12:35Z [SERVICES] INFO: Starting nscd kuma-wait-1 | 2023-11-12T16:12:36.307856735Z Waiting for uptime-kuma:3001 .. up! kuma-wait-1 | 2023-11-12T16:12:36.307896810Z Everything is up kuma-wait-1 exited with code 0 ``` </details> --- Looking at [`stack.ts`](https://github.com/louislam/dockge/blob/317c97650d3b8f797759250ee986eef79f5e807f/backend/stack.ts#L228), I see it performs a [`statusConvert`](https://github.com/louislam/dockge/blob/317c97650d3b8f797759250ee986eef79f5e807f/backend/stack.ts#L250) which checks if the status string starts with `exited`. So I ran the following command in the stacks directory to see the status of the `kuma` stack. `$ docker compose ls --all --format json | jq '.[] | select(.Name == "kuma")'` ```json { "Name": "kuma", "Status": "exited(1), running(1)", "ConfigFiles": "./collection/kuma/compose.yaml" } ``` It has multiple statuses because one of the containers has exited, and the other one still running. **Possible solution** Maybe instead of `startsWith` try with [`includes`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes)(?)
Author
Owner

@louislam commented on GitHub (Nov 12, 2023):

"Status": "exited(1), running(1)",

Thanks, I didn't know it contains multiple status.

@louislam commented on GitHub (Nov 12, 2023): > "Status": "exited(1), running(1)", Thanks, I didn't know it contains multiple status.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/dockge-louislam#1
No description provided.