Dockerfiles API
- Tier: Free, Premium, Ultimate
- Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated
GitLab provides an API endpoint for Dockerfile templates available to the entire instance.
Default templates are defined at
vendor/Dockerfile
in the GitLab repository.
Users with the Guest role can’t access the Dockerfiles templates. For more information, see Project and group visibility.
Override Dockerfile API templates
- Tier: Premium, Ultimate
- Offering: GitLab Self-Managed, GitLab Dedicated
In GitLab Premium and Ultimate tiers, GitLab instance administrators can override templates in the Admin area.
List Dockerfile templates
Get all Dockerfile templates.
GET /templates/dockerfiles
Example request:
curl "https://gitlab.example.com/api/v4/templates/dockerfiles"
Example response:
[
{
"key": "Binary",
"name": "Binary"
},
{
"key": "Binary-alpine",
"name": "Binary-alpine"
},
{
"key": "Binary-scratch",
"name": "Binary-scratch"
},
{
"key": "Golang",
"name": "Golang"
},
{
"key": "Golang-alpine",
"name": "Golang-alpine"
},
{
"key": "Golang-scratch",
"name": "Golang-scratch"
},
{
"key": "HTTPd",
"name": "HTTPd"
},
{
"key": "Node",
"name": "Node"
},
{
"key": "Node-alpine",
"name": "Node-alpine"
},
{
"key": "OpenJDK",
"name": "OpenJDK"
},
{
"key": "PHP",
"name": "PHP"
},
{
"key": "Python",
"name": "Python"
},
{
"key": "Python-alpine",
"name": "Python-alpine"
},
{
"key": "Python2",
"name": "Python2"
},
{
"key": "Ruby",
"name": "Ruby"
},
{
"key": "Ruby-alpine",
"name": "Ruby-alpine"
},
{
"key": "Rust",
"name": "Rust"
},
{
"key": "Swift",
"name": "Swift"
}
]
Single Dockerfile template
Get a single Dockerfile template.
GET /templates/dockerfiles/:key
Attribute | Type | Required | Description |
---|---|---|---|
key | string | yes | The key of the Dockerfile template |
Example request:
curl "https://gitlab.example.com/api/v4/templates/dockerfiles/Binary"
Example response:
{
"name": "Binary",
"content": "# This file is a template, and might need editing before it works on your project.\n# This Dockerfile installs a compiled binary into a bare system.\n# You must either commit your compiled binary into source control (not recommended)\n# or build the binary first as part of a CI/CD pipeline.\n\nFROM buildpack-deps:buster\n\nWORKDIR /usr/local/bin\n\n# Change `app` to whatever your binary is called\nAdd app .\nCMD [\"./app\"]\n"
}
Docs
Edit this page to fix an error or add an improvement in a merge request.
Create an issue to suggest an improvement to this page.
Product
Create an issue if there's something you don't like about this feature.
Propose functionality by submitting a feature request.
Feature availability and product trials
View pricing to see all GitLab tiers and features, or to upgrade.
Try GitLab for free with access to all features for 30 days.
Get help
If you didn't find what you were looking for, search the docs.
If you want help with something specific and could use community support, post on the GitLab forum.
For problems setting up or using this feature (depending on your GitLab subscription).
Request support