← Back to Dashboard
Verified Production Fix

[docker/cli] The new `docker images' output format is pretty unusable

GH-docker/cli#6650 • Mar 07, 2026

### ROOT CAUSE The issue stems from Docker changing the default output format of the `docker images` command, which breaks legacy code relying on the previous table format. Additionally, image names are now truncated by default, requiring the `--no-trunc` flag for readability, adding inconvenience. ### CODE FIX To address these concerns, we can introduce a new configuration option to revert the output format to the traditional table and prevent image truncation by default. **Step-by-Step Explanation:** 1. **Introduce a Configuration Flag:** - Create a new environment variable `DOCKER_TABLE_OUTPUT` which, when set to `true`, switches `docker images` to the table format. 2. **Modify Output Logic:** - Update the `docker images` command to check the `DOCKER_TABLE_OUTPUT` environment variable. If set, use the table format; otherwise, use the JSON-like format. 3. **Prevent Image Truncation by Default:** - Change the default behavior of `docker images` to not truncate image names unless explicitly specified with a new flag (e.g., `--trunc`). **Proposed Code Changes:** 1. **Add Environment Variable Check:** - In the Docker CLI, modify the `images` command to read the `DOCKER_TABLE_OUTPUT` variable.
bash
   if [ "$DOCKER_TABLE_OUTPUT" = "true" ]; then
       # Output in table format
       docker image ls --format "table"
   else
       # Use the current JSON-like output
       docker image ls
   fi
   


2. **Modify Docker Configuration:**
   - Update Docker's configuration to support the new environment variable and flag.

   
dockerfile
   ENV DOCKER_TABLE_OUTPUT=false
   


3. **Introduce `--no-trunc` as Default:**
   - Change the default behavior of `docker images` to not truncate image names.

   
bash
   # By default, image names are not truncated
   docker images --no-trunc
   


**Implementation:**

- **Docker CLI Update:**
  - Edit the `docker images` command logic to respect the `DOCKER_TABLE_OUTPUT` variable and default to `--no-trunc`.

- **User Instructions:**
  - Users can set `export DOCKER_TABLE_OUTPUT=true` to revert to the table format.
  - Image names will remain untruncated by default unless the `--trunc` flag is used.

**Summary:**
By introducing a configuration flag and adjusting the default behavior, Docker can maintain backward compatibility while allowing flexibility for new use cases. This solution respects legacy systems and improves the default user experience.

Deploy with DigitalOcean

Use this fix in production instantly. Claim your $200 developer credit.

Get Started →