Repository navigation
Closed as not planned
Description
I think the test field in healthcheck should be abstracted into a new cmd field and the time intervals could also be humanized.
Currently the test field is a single list where the first element has special meaning:
#HealthCheck: {
test?: [...string]
interval?: int
timeout?: int
startperiod?: int
retries?: int
}The options are:
[]: inherit healthcheck["NONE"]: disable healthcheck["CMD", args...]: exec arguments directly["CMD-SHELL", command]: run command with system's default shell
Here's what some dockerfile instructions produce:
CMD-SHELL
HEALTHCHECK --interval=5m --timeout=3s CMD curl -f http://localhost/ || exit 1healthcheck: {
test: [
"CMD-SHELL",
"curl -f http://localhost/ || exit 1",
]
interval: 300000000000
timeout: 3000000000
}CMD
HEALTHCHECK --interval=5m --timeout=3s CMD ["curl", "-f", "http://localhost/"]healthcheck: {
test: [
"CMD",
"curl",
"-f",
"http://localhost/",
]
interval: 300000000000
timeout: 3000000000
}NONE
HEALTHCHECK NONEhealthcheck: {
test: ["NONE"]
}Proposal
Change to:
#HealthCheck: {
{
disable: true
} | {
cmd: string | [...string]
interval?: int | #Duration
timeout?: int | #Duration
start_period?: int | #Duration
retries?: int
}
}
#Duration: string // regex hereThen, the previous calls would become:
config: {
healthcheck: {
cmd: "curl -f http://localhost/ || exit 1"
interval: "3s"
timeout: "3s"
}
}
config: {
healthcheck: {
cmd: ["curl", "-f", "http://localhost/"]
interval: "3s"
timeout: "3s"
}
}
config: {
healthcheck: disable: true
}Metadata
Metadata
Assignees
Labels
No labels
Activity
helderco commentedon Feb 22, 2022
On second thought, docker compose uses the
testfrom the spec: https://docs.docker.com/compose/compose-file/compose-file-v3/#healthcheckDo we prefer familiarity with compose or dockerfile? I think maybe take the best ideas from both and keep it as simple as possible for users.
shykes commentedon Dec 21, 2022
I'm closing this since the 0.2 CUE API is frozen, in favor of the GraphQL API.