"docker context use" usage fails with roaming profile/home directory
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 6.1k
- Forks
- 2.2k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 43
Description
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:
- Have a linux home directory that uses shared or synchronized storage on 2 or more systems.
- Create a new docker context on one of the machines/vms using an ssh connection:
docker context create mycontext --docker "host=ssh://username@server" - Activate the remote context:
docker context use mycontext - 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the listed docker context create, docker context use, and docker ps commands using a shared Linux home directory. Start by tracing Docker CLI context selection and SSH execution, then verify that a remote context no longer recurses or hangs when context data is shared. Done means docker ps returns containers from the remote machine.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, go
- Domain
- cli, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100