mirror of
https://github.com/sablierapp/sablier.git
synced 2025-12-25 06:49:31 +01:00
When an instance does not exist yet and needs to be started, its status is not assumed to be starting anymore. Instead, the statue will be retrieved from the provider. This changes one thing, it's that you may be able to start and access your services instantly because they'll be instantly seen as ready. With this change, you might want to make sure that your containers have a proper healthcheck used to determine when the application is able to process incoming requests. * refactor: add interface guards * refactor(providers): remove instance.State as a return value from Stop and Start * test(e2e): add healthcheck on nginx container Because now the container check is so fast, we need to add a delay on which the container is considered started and healthy to have a proper waiting page. * fix(tests): using acouvreur/whoami:v1.10.2 instead of containous/whoami:v1.5.0 This image simply retrieve the curl binary from curlimages/curl:8.8.0 to be able to add proper docker healthcheck commands. Once this is merged with traefik/whoami, I'll update back to the original image. See https://github.com/traefik/whoami/issues/33
1.3 KiB
1.3 KiB
Docker
The Docker provider communicates with the docker.sock socket to start and stop containers on demand.
Use the Docker provider
In order to use the docker provider you can configure the provider.name property.
File (YAML)
provider:
name: docker
CLI
sablier start --provider.name=docker
Environment Variable
PROVIDER_NAME=docker
!> Ensure that Sablier has access to the docker socket!
services:
sablier:
image: acouvreur/sablier:1.8.0-beta.8
command:
- start
- --provider.name=docker
volumes:
- '/var/run/docker.sock:/var/run/docker.sock'
Register containers
For Sablier to work, it needs to know which docker container to start and stop.
You have to register your containers by opting-in with labels.
services:
whoami:
image: acouvreur/whoami:v1.10.2
labels:
- sablier.enable=true
- sablier.group=mygroup
How does Sablier knows when a container is ready?
If the container defines a Healthcheck, then it will check for healthiness before stating the ready status.
If the containers does not define a Healthcheck, then as soon as the container has the status started