Skip to content

"docker context use" usage fails with roaming profile/home directory #2878

@ttutko

Description

@ttutko

Description

In one particular linux environment I work in, no matter what virtual machine I ssh into, my home directory roams with me (i.e. it is using shared storage). While I have nothing to do with that configuration, it is convenient for many things. However, I tried to create a docker context using ssh:// format to connect to a VM that is a swarm manager. When I do then docker use <contextname> and issue just about any docker command, it will hang and never return anything from the command.

Steps to reproduce the issue:

  1. Have a linux home directory that uses shared or synchronized storage on 2 or more systems.
  2. Create a new docker context on one of the machines/vms using an ssh connection: docker context create mycontext --docker "host=ssh://username@server"
  3. Activate the remote context: docker context use mycontext
  4. Issue a simple command such as docker ps

Describe the results you received:

Command never returned.

Describe the results you expected:

See a list of containers running on the remote machine.

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

What I believe is happening is that when I create and use a context, it's stored in ~/.docker/context according to the docs. Since this is shared across all vm's that I ssh into, the first instant I run a command it ssh's into the vm, tries to run the docker command which sees that the current context is ssh and it recursively gets stuck in an endless loop.

I believe the same thing could happen on Windows as well if roaming profiles were turned on depending on where the ".docker/context" folder lives.

Output of docker version:

The system is air-gapped so I can't paste the full version/info commands.

Version: 19.03.9
CLI Version: 1.40

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