GitLab CI "Service probably didn't start properly": causes and fixes
Short answer
*** WARNING: Service … probably didn't start properly comes from GitLab Runner's Docker executor. Before the job's script, the runner waits, 30 seconds by default, for a TCP port of each service to accept a connection, and prints this warning when none does or the image exposes no port. The job carries on anyway, so the real failure usually comes later, such as connection refused or a failed host lookup. The warning's Service container logs part shows why: a service that exited for a missing setting, Docker-in-Docker without privileged mode, or a slow start. Fix the service, wait for it in before_script, point the check at the right port with HEALTHCHECK_TCP_PORT, or raise wait_for_services_timeout on your own runner.
Before a job’s script starts, the log shows a warning about one of its services:
Starting service postgres:16...
Using docker image sha256:… for postgres:16 with digest postgres@sha256:… ...
Waiting for services to be up and running (timeout 30 seconds)...
*** WARNING: Service runner-…-postgres-0 probably didn't start properly.
Health check error:
service "runner-…-postgres-0-wait-for-service" timeout
Health check container logs:
… waiting for TCP connection to 4f9c1d2e7a3b on [5432]...
Service container logs:
… Error: Database is uninitialized and superuser password is not specified.
The job then runs anyway, and fails later when it tries to use the service, with something like connection refused or a failed host lookup. Here’s what the warning checks with GitLab Runner 19.5, and how to fix what it finds.
What the runner checks
On the Docker executor, the runner starts each service, then runs a small helper container that tries to open a TCP connection to it:
- The ports are the TCP ports the service image exposes, up to 20, and one answering is enough. The helper reaches the service by its container’s short ID. A
HEALTHCHECK_TCP_PORTvariable on the service makes it try only that port. - The wait lasts 30 seconds by default, or what the runner’s
wait_for_services_timeoutsays. - The warning appears when no port answers in time, or when the image exposes none. When no port answers, it has three parts: the health check error, the helper’s log, and the service’s own log. When the image exposes no port, no helper runs, so the helper’s log is missing.
The health check error tells you which case it is: service "…-wait-for-service" timeout means no port answered in time, service "…" has no exposed ports means there was nothing to check, and service "…-wait-for-service" health check: … means the check itself failed. The Service container logs part shows the reason.
Common causes
- The service exited. Its log ends with an error, often a missing setting. The postgres image, for example, stops with
Database is uninitialized and superuser password is not specified.unlessPOSTGRES_PASSWORDis set, orPOSTGRES_HOST_AUTH_METHODistrust. Variables you set in.gitlab-ci.ymlare passed to services too; variables from the project’s CI/CD settings aren’t, unless you reference them invariables:. - Docker-in-Docker can’t start. The
docker:dindlog showsmount: permission denied (are you root?)when the service isn’t privileged:privileged = trueis off on the runner,services_privileged = false, or the image isn’t inallowed_privileged_services. See GitLab CI “Cannot connect to the Docker daemon”. - The service starts slowly. Some databases and search engines take longer than 30 seconds. The job can still pass if it doesn’t need the service right away.
- The image exposes no port. A service that works on the job’s files in
/builds, rather than over the network, gets the warning but still does its job. If it does listen, setHEALTHCHECK_TCP_PORTto that port.
Fix it
Fix what the service log says, such as a missing variable or a runner that isn’t privileged.
Wait for the service in before_script, so the script starts only once it answers:
test:
image: postgres:16
services:
- name: postgres:16
alias: db
variables:
POSTGRES_PASSWORD: example
PGPASSWORD: example
before_script:
- for i in $(seq 1 60); do pg_isready -h db && break; sleep 1; done
script:
- psql -h db -U postgres -c 'select 1'
Point the check at the right port with HEALTHCHECK_TCP_PORT in the service’s variables.
Raise the timeout on your own runner in the [runners.docker] section of config.toml, such as wait_for_services_timeout = 120. -1 turns the wait off.
On Kubernetes
The Kubernetes executor doesn’t print this warning. It waits only for services that set HEALTHCHECK_TCP_PORT, and then for every port set that way, logging waiting for TCP connection to localhost on […]. Without that variable, the script starts at once, so wait for the service in before_script. With it, there’s no 30-second limit: a port that never opens holds the job until its timeout.
On your phone
MergeBell shows a job’s log live, so the warning and the service’s log are there as soon as the job starts, and you can cancel a job you know will fail, or retry it once the service is fixed, on the free tier. More in how to retry a failed GitLab pipeline.
Frequently asked questions
What does "Service probably didn't start properly" mean in GitLab CI?
It's the Docker executor's service health check. After starting the job's services, GitLab Runner waits, 30 seconds by default, for one of each service's exposed TCP ports to accept a connection. When none does in time, or the image exposes no port, it prints the warning with the health check error and the service container's own logs, then runs the job anyway.
Does the "probably didn't start properly" warning fail my job?
Not by itself: the job continues. If the script uses the service before it's ready, its commands fail, with errors such as connection refused or a failed host lookup. If the service starts a little later, or the job doesn't reach it over the network, the job can still pass.
How do I find out why a GitLab CI service didn't start?
Read the Service container logs part of the warning, which shows the service's own output. A database that exited because a required variable is missing, such as POSTGRES_PASSWORD for the postgres image, and Docker-in-Docker printing mount: permission denied (are you root?) when the service isn't privileged are the usual causes.
How do I make GitLab Runner wait longer for a service?
On your own runner, set wait_for_services_timeout in the [runners.docker] section of config.toml, for example to 120 seconds; -1 turns the wait off. In the job, wait for the service yourself in before_script, for example with a loop around pg_isready for PostgreSQL.
Does the Kubernetes executor show this warning?
No. The Kubernetes executor waits for services only when a service sets HEALTHCHECK_TCP_PORT, and then waits for every port listed that way. Without it, the script starts at once, so wait for the service in before_script.
Sources
- GitLab docs — Services: health check workflow
- GitLab Runner docs — [runners.docker] settings (wait_for_services_timeout)
- GitLab docs — Docker-in-Docker with TLS on Kubernetes (HEALTHCHECK_TCP_PORT)
- GitLab Runner source — the service health check (services.go)
Checked against these pages on 17 November 2026. GitLab changes quickly — if something here no longer matches, tell us and we will fix it.
Do this from your phone with MergeBell
Free for the whole review loop: the To-Do inbox, diffs and line comments, approve and merge, pipelines with retry, and push alerts for your To-Dos. Works with gitlab.com and self-managed GitLab 16.0+.
Get MergeBell for iPhoneGet MergeBell for Android
On the App Store for iOS 26 or later and on Google Play for Android 12 or later. An independent app, not affiliated with GitLab Inc.