Skip to content

healthcheck.test does not accept string literal shorthand of CMD-SHELL #58

@anatawa12

Description

@anatawa12
services:
  redis:
    restart: always
    image: redis:7-alpine
    volumes:
      - redis-data:/data
    healthcheck:
      test: "redis-cli ping"
      interval: 5s
      retries: 20
    ports:
      - "6379:6379"

This errors with Error: typeMismatch(Yams.Node.Sequence, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "services", intValue: nil), _DictionaryCodingKey(stringValue: "redis", intValue: nil), CodingKeys(stringValue: "healthcheck", intValue: nil), CodingKeys(stringValue: "test", intValue: nil)], debugDescription: "Expected to decode Sequence but found Node instead.", underlyingError: nil))

test defines the command Compose runs to check container health. It can be either a string or a list. If it's a list, the first item must be either NONE, CMD or CMD-SHELL. If it's a string, it's equivalent to specifying CMD-SHELL followed by that string.

https://github.com/compose-spec/compose-spec/blob/main/05-services.md#healthcheck

container-compose v0.9.0 installed with brew

$ container-compose --version           
container-compose version 0.9.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions