Skip to content

feat: update Docker configuration to use DOKPLOY environment variables#3962

Merged
Siumauricio merged 1 commit intocanaryfrom
3955-bug-typeerror-invalid-url-with-dockersock-preventing-any-deployments-when-building-dockerfiles-on-version-v0285
Mar 10, 2026
Merged

feat: update Docker configuration to use DOKPLOY environment variables#3962
Siumauricio merged 1 commit intocanaryfrom
3955-bug-typeerror-invalid-url-with-dockersock-preventing-any-deployments-when-building-dockerfiles-on-version-v0285

Conversation

@Siumauricio
Copy link
Contributor

@Siumauricio Siumauricio commented Mar 10, 2026

What is this PR about?

Please describe in a short paragraph what this PR is about.

Checklist

Before submitting this PR, please make sure that:

  • You created a dedicated branch based on the canary branch.
  • You have read the suggestions in the CONTRIBUTING.md file https://github.com/Dokploy/dokploy/blob/canary/CONTRIBUTING.md#pull-request
  • You have tested this PR in your local instance. If you have not tested it yet, please do so before submitting. This helps avoid wasting maintainers' time reviewing code that has not been verified by you.

Issues related (if applicable)

closes #3955

Screenshots (if applicable)

Greptile Summary

This PR renames DOCKER_HOST and DOCKER_PORT environment variables to DOKPLOY_DOCKER_HOST and DOKPLOY_DOCKER_PORT respectively, using an application-specific prefix to avoid conflicts with Docker's own well-known DOCKER_HOST env var (which dockerode and the Docker CLI also read). This is a breaking change for existing users who have set these env vars.

  • DOCKER_HOSTDOKPLOY_DOCKER_HOST and DOCKER_PORTDOKPLOY_DOCKER_PORT are correctly renamed in both the exported constants and the Docker constructor options.
  • Inconsistency: DOCKER_API_VERSION was not renamed to DOKPLOY_DOCKER_API_VERSION, leaving the three related Docker connection env vars on different naming conventions.
  • No other files import these constants, so no additional code changes are required.
  • The .env.example files do not reference these env vars and were not updated, but they don't currently document these optional settings anyway.

Confidence Score: 4/5

  • This PR is safe to merge; it introduces a breaking env var rename with one minor inconsistency left over.
  • The change is small and well-scoped — it only touches constant declarations and their use in the Docker constructor. The logic is correct. The only concern is the inconsistency where DOCKER_API_VERSION was not renamed alongside the other two variables, and the fact that existing users with DOCKER_HOST/DOCKER_PORT set will need to update their environment.
  • packages/server/src/constants/index.ts — minor inconsistency with DOCKER_API_VERSION not being renamed.

Last reviewed commit: 3501996

Greptile also left 1 inline comment on this PR.

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Mar 10, 2026
@Siumauricio Siumauricio merged commit 2879816 into canary Mar 10, 2026
5 checks passed
@Siumauricio Siumauricio deleted the 3955-bug-typeerror-invalid-url-with-dockersock-preventing-any-deployments-when-building-dockerfiles-on-version-v0285 branch March 10, 2026 08:12
@dosubot dosubot bot added the enhancement New feature or request label Mar 10, 2026
@dosubot
Copy link

dosubot bot commented Mar 10, 2026

Documentation Updates

2 document(s) were updated by changes in this PR:

CONTRIBUTING
View Changes
@@ -67,8 +67,8 @@
 The following environment variables can be added to your `.env` file if you need custom Docker daemon configuration:
 
 - **DOCKER_API_VERSION**: Specify which Docker API version to use (optional)
-- **DOCKER_HOST**: Specify a custom Docker daemon host (optional)
-- **DOCKER_PORT**: Specify a custom Docker daemon port (optional)
+- **DOKPLOY_DOCKER_HOST**: Specify a custom Docker daemon host (optional)
+- **DOKPLOY_DOCKER_PORT**: Specify a custom Docker daemon port (optional)
 
 These variables are typically not needed for standard local development but can be useful if you need to connect to a remote Docker daemon or require a specific Docker API version.
 
README
View Changes
@@ -38,9 +38,9 @@
 
 - **DOCKER_API_VERSION** (optional) - Specifies which Docker API version to use when connecting to the Docker daemon. If not set, the Docker client uses the default API version.
 
-- **DOCKER_HOST** (optional) - Specifies the Docker daemon host to connect to. If not set, uses the default Docker socket connection.
-
-- **DOCKER_PORT** (optional) - Specifies the port for connecting to the Docker daemon. If not set, uses the default port.
+- **DOKPLOY_DOCKER_HOST** (optional) - Specifies the Docker daemon host to connect to. If not set, uses the default Docker socket connection.
+
+- **DOKPLOY_DOCKER_PORT** (optional) - Specifies the port for connecting to the Docker daemon. If not set, uses the default port.
 
 These variables allow advanced users to customize how the Dokploy API server connects to Docker, which can be useful for connecting to remote Docker daemons or using specific API versions.
 

How did I do? Any feedback?  Join Discord

@@ -3,21 +3,21 @@ import Docker from "dockerode";

export const IS_CLOUD = process.env.IS_CLOUD === "true";
export const DOCKER_API_VERSION = process.env.DOCKER_API_VERSION;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent DOCKER_API_VERSION naming

DOCKER_HOST and DOCKER_PORT were renamed to use the DOKPLOY_ prefix to avoid conflicts with Docker's own well-known environment variables, but DOCKER_API_VERSION was left unchanged. Since DOCKER_API_VERSION follows the same pattern, it should also be renamed to DOKPLOY_DOCKER_API_VERSION for consistency.

Suggested change
export const DOCKER_API_VERSION = process.env.DOCKER_API_VERSION;
export const DOCKER_API_VERSION = process.env.DOKPLOY_DOCKER_API_VERSION;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: TypeError: Invalid URL with docker.sock preventing any deployments when building Dockerfiles on version v0.28.5

1 participant