mirror of
https://github.com/LukeHagar/Dokploy-ts-sdk.git
synced 2025-12-06 04:19:37 +00:00
29 KiB
29 KiB
Docker
(docker)
Overview
Available Operations
getContainers
Example Usage
import { Dokploy } from "dokploy";
const dokploy = new Dokploy({
authorization: process.env["DOKPLOY_AUTHORIZATION"] ?? "",
});
async function run() {
const result = await dokploy.docker.getContainers();
console.log(result);
}
run();
Standalone function
The standalone function version of this method:
import { DokployCore } from "dokploy/core.js";
import { dockerGetContainers } from "dokploy/funcs/dockerGetContainers.js";
// Use `DokployCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const dokploy = new DokployCore({
authorization: process.env["DOKPLOY_AUTHORIZATION"] ?? "",
});
async function run() {
const res = await dockerGetContainers(dokploy);
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("dockerGetContainers failed:", res.error);
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.DockerGetContainersRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<models.ErrorT>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.DokployDefaultError | 4XX, 5XX | */* |
restartContainer
Example Usage
import { Dokploy } from "dokploy";
const dokploy = new Dokploy({
authorization: process.env["DOKPLOY_AUTHORIZATION"] ?? "",
});
async function run() {
const result = await dokploy.docker.restartContainer({
containerId: "<id>",
});
console.log(result);
}
run();
Standalone function
The standalone function version of this method:
import { DokployCore } from "dokploy/core.js";
import { dockerRestartContainer } from "dokploy/funcs/dockerRestartContainer.js";
// Use `DokployCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const dokploy = new DokployCore({
authorization: process.env["DOKPLOY_AUTHORIZATION"] ?? "",
});
async function run() {
const res = await dockerRestartContainer(dokploy, {
containerId: "<id>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("dockerRestartContainer failed:", res.error);
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.DockerRestartContainerRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<models.ErrorT>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.DokployDefaultError | 4XX, 5XX | */* |
getConfig
Example Usage
import { Dokploy } from "dokploy";
const dokploy = new Dokploy({
authorization: process.env["DOKPLOY_AUTHORIZATION"] ?? "",
});
async function run() {
const result = await dokploy.docker.getConfig({
containerId: "<id>",
});
console.log(result);
}
run();
Standalone function
The standalone function version of this method:
import { DokployCore } from "dokploy/core.js";
import { dockerGetConfig } from "dokploy/funcs/dockerGetConfig.js";
// Use `DokployCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const dokploy = new DokployCore({
authorization: process.env["DOKPLOY_AUTHORIZATION"] ?? "",
});
async function run() {
const res = await dockerGetConfig(dokploy, {
containerId: "<id>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("dockerGetConfig failed:", res.error);
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.DockerGetConfigRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<models.ErrorT>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.DokployDefaultError | 4XX, 5XX | */* |
getContainersByAppNameMatch
Example Usage
import { Dokploy } from "dokploy";
const dokploy = new Dokploy({
authorization: process.env["DOKPLOY_AUTHORIZATION"] ?? "",
});
async function run() {
const result = await dokploy.docker.getContainersByAppNameMatch({
appName: "<value>",
});
console.log(result);
}
run();
Standalone function
The standalone function version of this method:
import { DokployCore } from "dokploy/core.js";
import { dockerGetContainersByAppNameMatch } from "dokploy/funcs/dockerGetContainersByAppNameMatch.js";
// Use `DokployCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const dokploy = new DokployCore({
authorization: process.env["DOKPLOY_AUTHORIZATION"] ?? "",
});
async function run() {
const res = await dockerGetContainersByAppNameMatch(dokploy, {
appName: "<value>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("dockerGetContainersByAppNameMatch failed:", res.error);
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.DockerGetContainersByAppNameMatchRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<models.ErrorT>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.DokployDefaultError | 4XX, 5XX | */* |
getContainersByAppLabel
Example Usage
import { Dokploy } from "dokploy";
const dokploy = new Dokploy({
authorization: process.env["DOKPLOY_AUTHORIZATION"] ?? "",
});
async function run() {
const result = await dokploy.docker.getContainersByAppLabel({
appName: "<value>",
});
console.log(result);
}
run();
Standalone function
The standalone function version of this method:
import { DokployCore } from "dokploy/core.js";
import { dockerGetContainersByAppLabel } from "dokploy/funcs/dockerGetContainersByAppLabel.js";
// Use `DokployCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const dokploy = new DokployCore({
authorization: process.env["DOKPLOY_AUTHORIZATION"] ?? "",
});
async function run() {
const res = await dockerGetContainersByAppLabel(dokploy, {
appName: "<value>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("dockerGetContainersByAppLabel failed:", res.error);
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.DockerGetContainersByAppLabelRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<models.ErrorT>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.DokployDefaultError | 4XX, 5XX | */* |