2019-12-04 20:38:33 +05:30
---
2021-04-29 21:17:54 +05:30
stage: Create
group: Source Code
2022-11-25 23:54:43 +05:30
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments
2019-12-04 20:38:33 +05:30
type: reference
---
2021-11-11 11:23:49 +05:30
# Dockerfiles API **(FREE)**
2018-12-05 23:21:45 +05:30
2021-04-29 21:17:54 +05:30
GitLab provides an API endpoint for instance-level Dockerfile templates.
Default templates are defined at
[`vendor/Dockerfile` ](https://gitlab.com/gitlab-org/gitlab-foss/-/tree/master/vendor/Dockerfile )
in the GitLab repository.
## Override Dockerfile API templates **(PREMIUM SELF)**
2023-07-09 08:55:56 +05:30
In [GitLab Premium and Ultimate ](https://about.gitlab.com/pricing/ ) tiers, GitLab instance
2021-04-29 21:17:54 +05:30
administrators can override templates in the
[Admin Area ](../../user/admin_area/settings/instance_template_repository.md ).
2019-12-04 20:38:33 +05:30
2018-12-05 23:21:45 +05:30
## List Dockerfile templates
Get all Dockerfile templates.
2020-04-08 14:13:33 +05:30
```plaintext
2018-12-05 23:21:45 +05:30
GET /templates/dockerfiles
```
2020-03-13 15:44:24 +05:30
```shell
2021-02-22 17:27:13 +05:30
curl "https://gitlab.example.com/api/v4/templates/dockerfiles"
2018-12-05 23:21:45 +05:30
```
Example response:
```json
[
{
"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"
2020-04-22 19:07:51 +05:30
},
2020-10-24 23:57:45 +05:30
{
"key": "Rust",
"name": "Rust"
},
2020-04-22 19:07:51 +05:30
{
"key": "Swift",
"name": "Swift"
2018-12-05 23:21:45 +05:30
}
]
```
## Single Dockerfile template
Get a single Dockerfile template.
2020-04-08 14:13:33 +05:30
```plaintext
2018-12-05 23:21:45 +05:30
GET /templates/dockerfiles/:key
```
| Attribute | Type | Required | Description |
| ---------- | ------ | -------- | ----------- |
| `key` | string | yes | The key of the Dockerfile template |
2020-03-13 15:44:24 +05:30
```shell
2021-02-22 17:27:13 +05:30
curl "https://gitlab.example.com/api/v4/templates/dockerfiles/Binary"
2018-12-05 23:21:45 +05:30
```
Example response:
```json
{
"name": "Binary",
2020-11-24 15:15:51 +05:30
"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"
2018-12-05 23:21:45 +05:30
}
```
2019-12-04 20:38:33 +05:30
<!-- ## Troubleshooting
Include any troubleshooting steps that you can foresee. If you know beforehand what issues
one might have when setting this up, or when something is changed, or on upgrading, it's
important to describe those, too. Think of things that may go wrong and include them here.
This is important to minimize requests for support, and to avoid doc comments with
questions that you know someone might ask.
2023-01-13 00:05:48 +05:30
Each scenario can be a third-level heading, for example `### Getting error message X` .
2019-12-04 20:38:33 +05:30
If you have none to add when creating a doc, leave this section in place
but commented out to help encourage others to add to it in the future. -->