Skip to content

"docker context use" appears to have no effect #1809

@sudo-bmitch

Description

@sudo-bmitch

Description

I'm giving 19.03.0-beta1 a spin and trying to use the fast context switcher from PR #1501 with no luck.

Steps to reproduce the issue:

Current environment configured with:

DOCKER_TLS_VERIFY=1
DOCKER_HOST=tcp://127.0.0.1:2376

Start a DinD instance on 22375:

port=22375
docker run -d --rm --privileged \
  --name docker-${port} -p 127.0.0.1:${port}:2375 \
  docker:stable-dind

Define a new context:

$ docker context create --docker host=tcp://127.0.0.1:22375 dind22375
dind22375                                
Successfully created context "dind22375"

List the context:

$ docker context ls                            
NAME                DESCRIPTION                               DOCKER ENDPOINT         KUBERNETES ENDPOINT   ORCHESTRATOR
default *           Current DOCKER_HOST based configuration   tcp://127.0.0.1:2376                          swarm
dind22375                                                     tcp://127.0.0.1:22375

Try to switch context:

$ docker context use dind22375    
dind22375                                                            
Current context is now "dind22375"       

Describe the results you received:

At that point, there is still a "*" after the default context in the list, and all docker commands continue to operate on my 2376 instance of docker rather than the 22375 instance.

Describe the results you expected:

Commands should run against 22375.

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

Output of docker version:

$ docker version
Client:
 Version:           19.03.0-beta1
 API version:       1.40
 Go version:        go1.11.5
 Git commit:        62240a9
 Built:             Thu Apr  4 19:18:33 2019
 OS/Arch:           linux/amd64
 Experimental:      true

Server:
 Engine:
  Version:          19.03.0-beta1
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.11.5
  Git commit:       62240a9
  Built:            Thu Apr  4 19:17:20 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.5
  GitCommit:        bb71b10fd8f58240ca47fbb579b9d1028eea7c84
 runc:
  Version:          1.0.0-rc6+dev
  GitCommit:        2b18fe1d885ee5083ef9f0838fee39b62d653e30
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Output of docker info:

$ docker info
Client:
 Debug Mode: false
 Plugins:
  app: Docker Application Packages (Docker Inc., v0.6.0-202-gbaf0b246c7)

Server:
 Containers: 23
  Running: 8
  Paused: 0
  Stopped: 15
 Images: 587
 Server Version: 19.03.0-beta1
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: active
  NodeID: zxbiqah7y2lciu8qjwqjxlwd6
  Is Manager: true
  ClusterID: jzgbkgd7q5g1zw1kzj4qawdoh
  Managers: 1
  Nodes: 1
  Default Address Pool: 10.248.0.0/22
  SubnetSize: 24
  Data Path Port: 4789
  Orchestration:
   Task History Retention Limit: 5
  Raft:
   Snapshot Interval: 10000
   Number of Old Snapshots to Retain: 0
   Heartbeat Tick: 1
   Election Tick: 10
  Dispatcher:
   Heartbeat Period: 5 seconds
  CA Configuration:
   Expiry Duration: 3 months
   Force Rotate: 0
  Autolock Managers: false
  Root Rotation In Progress: false
  Node Address: 192.168.235.14
  Manager Addresses:
   192.168.235.14:2377
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: bb71b10fd8f58240ca47fbb579b9d1028eea7c84
 runc version: 2b18fe1d885ee5083ef9f0838fee39b62d653e30
 init version: fec3683
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 4.9.0-8-amd64
 Operating System: Debian GNU/Linux 9 (stretch)
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 5.739GiB
 Name: bmitch-asusr556l
 ID: 35159ce1-a8db-4141-82a6-a6fc4ed0de77
 Docker Root Dir: /home/var-docker
 Debug Mode: false
 Username: bmitch3020
 Registry: https://index.docker.io/v1/
 Labels:
  foo=bar
  env=laptop
  provider=generic
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

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

Physical, Linux on the laptop.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions