Verified Production Fix
[docker/cli] docker version JSON output uses mixed timestamp formats, seems to break downstream parsers (like VSCode DevContainers in remote configuration)
GH-docker/cli#6727 • Mar 07, 2026
### ROOT CAUSE
The Docker CLI outputs BuildTime fields in mixed formats (human-readable and ISO-8601) within the JSON output of `docker version --format '{{json .}}'`. This inconsistency causes JSON parsers, such as those used by VSCode DevContainers, to fail due to unexpected format changes.
### CODE FIX
To resolve this issue, we need to ensure all BuildTime fields in the JSON output are consistently formatted in ISO-8601. Here's how to implement the fix:
1. **Modify Client.BuildTime Generation**:
- **File**: `docker/clideb/version.go`
- **Change**: Update the code that sets `Client.BuildTime` to use `time.Now().UTC().Format(time.RFC3339)` to generate an ISO-8601 timestamp.
2. **Update Server.BuildTime**:
- **File**: `docker/server/server.go`
- **Change**: Ensure `Server.BuildTime` is set using the same ISO-8601 format.
3. **Standardize BuildTime in Components**:
- **File**: `docker/components/component.go`
- **Change**: For each component's `Details.BuildTime`, replace any existing formatting logic with a function that returns an ISO-8601 timestamp.
**Example Code Changes**:
- **In `version.go`**:
buildTime, err := time.ParseInLocation(time.RFC3339, buildTimeStr, time.UTC)
if err != nil {
// Handle error
}
buildTimeISO := buildTime.Format(time.RFC3339)
- **Helper Function**:
func GetISOTime(timestamp string) string {
loc, _ := time.ParseInLocation(time.RFC3339, timestamp, time.UTC)
return loc.Format(time.RFC3339)
}
By ensuring all BuildTime fields are in ISO-8601 format, the JSON output becomes consistent, preventing parsing errors in downstream tools.
Deploy with DigitalOcean
Use this fix in production instantly. Claim your $200 developer credit.
Get Started →
digital