2019-12-04 20:38:33 +05:30
---
type: reference
---
2018-12-05 23:21:45 +05:30
# Dockerfiles API
2019-12-04 20:38:33 +05:30
In GitLab, there is an API endpoint available for Dockerfiles. For more
information on Dockerfiles, see the
[Docker documentation ](https://docs.docker.com/engine/reference/builder/ ).
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
2018-12-05 23:21:45 +05:30
curl https://gitlab.example.com/api/v4/templates/dockerfiles
```
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": "OpenJDK-alpine",
"name": "OpenJDK-alpine"
},
{
"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
2018-12-05 23:21:45 +05:30
curl https://gitlab.example.com/api/v4/templates/dockerfiles/Binary
```
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.
Each scenario can be a third-level heading, e.g. `### Getting error message X` .
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. -->