Skip to content

Docker context segment doesn't seem to recognize DOCKER_CONTEXT environment variable #350

@scottslowe

Description

@scottslowe

Describe the bug
The Docker context segment does not appear to recognize the DOCKER_CONTEXT environment variable, which is another way to specify the context that the Docker CLI should use.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new Docker context (I used an SSH-based context to a Linux system with the Docker daemon installed).
  2. Run docker context use <new-context>. You should see a new segment show up in the prompt.
  3. Run docker context use default. The new segment will disappear.
  4. Run export DOCKER_CONTEXT=<new-context>. Note that no new segment appears in the prompt, even though the Docker CLI is correctly using the context (and docker context ls will show the specified context as the active one).

Expected behavior
I expected the Docker context segment to appear in the prompt when the DOCKER_CONTEXT environment variable is defined. This behavior is similar to the behavior of the segment that displays the name of the AWS CLI profile when the AWS_PROFILE environment variable is defined.

Environment (please complete the following information):

  • OS: macOS 12.3 on M1
  • Architecture: ARM64
  • Shell: Zsh 5.8

Additional context
None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions