Keep alive

I’d like to launch a service container using jobs.<job_id>.services and use docker exec in my steps to run the service when it needs to be started.

As far as I understand, I have to use a fake --health-cmd to be able to keep my container alive.

I’ve tried something like:

    image: 3.8-slim-buster
    options: >-
      --entrypoint /bin/bash
      --health-cmd "exit 1"
      --health-interval 10s
      --health-timeout 5s
      --health-retries 5
      - /workspace:/github/workspace

but it always fails:

/usr/bin/docker inspect --format="{{if .Config.Healthcheck}}{{print .State.Health.Status}}{{end}}" c811c0711c16eaf8a181ec91c9c39a75e566c669de828df25406b90aa56677cc
##[error]Failed to initialize, my_service_name service is unhealthy.

Is it possible to do that without modifying the Dockerfile of jobs.<job_id>.services.image?

Hi @lambda-xyz,

I copied your code and tried on my side, but it reports repository does not exist or may require 'docker login' . Do you have other settings?
I notice the error is similar with another ticket here, do you have env settting in top level or other places? Please try to set it in ‘jobs.<job_id>.services.env’ level.

If possible please share your repo/sample repo for further investigation.


Here is an example:

There is no env settings anywhere.

Hi @lambda-xyz,

Thanks for your reply!

I can repro the same on my side. However, with same setting, i tried another image “rabbitmq:latest”, the health check is passed. Please check my workflow here for your reference.

The issue should be related to the docker image used.


I know that it works with rabbitmq, postgresql or redis images.

My question is how to keep alive with a custom Docker image :slight_smile:

I can’t figure out why using a fake --health-cmd doesn’t work!