← All notes

Service containers run Docker services beside a job and are torn down when it ends

Answer: Service containers are Docker containers that host services a workflow may need, such as a database or a memory cache. You configure them with the services keyword on a job. GitHub creates a fresh container for each service and destroys it when the job completes. You cannot create and use service containers inside a composite action.

How a job reaches the service

If the job itself runs in a container, you access the service by the label you configure. That label becomes the hostname, and you do not need to map ports. If the job runs directly on the runner machine, access the service at localhost plus a mapped port, and you must map ports with the ports keyword.

The runner creates a Docker network on its own and manages each service container's life cycle. The Docker image to use as the service container is set with image. Map host and container ports in the form 8080:80.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: GitHub Docs, Communicating with Docker service containers, CC-BY-4.0 (https://raw.githubusercontent.com/github/docs/main/LICENSE). Copyright GitHub, Inc.; github/docs (GitHub), Workflow syntax: jobs.<job_id>.services, CC-BY-4.0 (https://raw.githubusercontent.com/github/docs/main/LICENSE). Copyright GitHub, Inc.. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: GitHub Docs, Communicating with Docker service containers, CC-BY-4.0 (https://raw.githubusercontent.com/github/docs/main/LICENSE). Copyright GitHub, Inc.; github/docs (GitHub), Workflow syntax: jobs.<job_id>.services, CC-BY-4.0 (https://raw.githubusercontent.com/github/docs/main/LICENSE). Copyright GitHub, Inc..

Cite this

Permanent ID: iil:note:0tzcjjek

iinventedlight. 2026. "Service containers run Docker services beside a job and are torn down when it ends." iinventedlight Library, iil:note:0tzcjjek, version of 2026-11-17. https://iinventedlight.com/library/notes/github-actions-service-containers/. License: CC-BY-4.0.

@misc{iil_note_0tzcjjek,
  author = {{iinventedlight}},
  title = {{Service containers run Docker services beside a job and are torn down when it ends}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-17},
  url = {https://iinventedlight.com/library/notes/github-actions-service-containers/},
  note = {Permanent ID iil:note:0tzcjjek. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/github-actions-service-containers.md.