X Tutup
Skip to content

Confusing warning when selecting default context with DOCKER_HOST set #1932

@kinghuang

Description

@kinghuang

Description

If the DOCKER_HOST environment variable is set and the default context is selected, a confusing warning is printed about DOCKER_HOST overriding the active context.

Steps to reproduce the issue:

  1. Set DOCKER_HOST=unix:///var/run/docker.sock (or any other endpoint).
  2. Do docker context use default.

Describe the results you received:

A warning message is printed.

$ docker context use default
default
Current context is now "default"
Warning: DOCKER_HOST environment variable overrides the active context. To use "default", either set the global --context flag, or unset DOCKER_HOST environment variable.

Describe the results you expected:

The default context, by design, uses the DOCKER_HOST based configuration. The warning message only makes sense when using non-default contexts. It should not be shown when using the default context.

Additional information you deem important (e.g. issue happens only occasionally):

N/A

Output of docker version:

Client: Docker Engine - Community
 Version:           19.03.0-rc2
 API version:       1.40
 Go version:        go1.12.5
 Git commit:        f97efcc
 Built:             Wed Jun  5 01:37:12 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.0-beta3
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.4
  Git commit:       c55e026
  Built:            Thu Apr 25 19:13:00 2019
  OS/Arch:          linux/amd64
  Experimental:     true
 containerd:
  Version:          v1.2.6
  GitCommit:        894b81a4b802e4eb2a91d1ce216b8817763c29fb
 runc:
  Version:          1.0.0-rc7+dev
  GitCommit:        029124da7af7360afa781a0234d1b083550f797c
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Output of docker info:

N/A

Additional environment details (AWS, VirtualBox, physical, etc.):

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup