StefanScherer / windows-docker-machine

Work with Windows containers and LCOW on Mac/Linux/Windows

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

'docker context ls' does not show '2019-box'

ajith-joseph opened this issue · comments

On a Mac, I did
$ git clone https://github.com/StefanScherer/windows-docker-machine
$ cd windows-docker-machine
$ vagrant up --provider virtualbox 2019-box
However 'docker context ls' does not show '2019-box'. It shows only the default one that was there before.

Here is the output of vagrant up
$ vagrant up --provider virtualbox 2019-box
==> vagrant: A new version of Vagrant is available: 2.2.9 (installed version: 2.2.7)!
==> vagrant: To upgrade visit: https://www.vagrantup.com/downloads.html

/opt/vagrant/embedded/gems/2.2.7/gems/vagrant-2.2.7/lib/vagrant/util/which.rb:37: warning: Insecure world writable dir /Volumes/SamsungUSB/work/windows-docker-machine in PATH, mode 040777
Bringing machine '2019-box' up with 'virtualbox' provider...
==> 2019-box: Checking if box 'StefanScherer/windows_2019_docker' version '2020.04.15' is up to date...
==> 2019-box: Clearing any previously set forwarded ports...
==> 2019-box: Clearing any previously set network interfaces...
==> 2019-box: Preparing network interfaces based on configuration...
2019-box: Adapter 1: nat
2019-box: Adapter 2: hostonly
==> 2019-box: Forwarding ports...
2019-box: 3389 (guest) => 3389 (host) (adapter 1)
2019-box: 5985 (guest) => 55985 (host) (adapter 1)
2019-box: 5986 (guest) => 55986 (host) (adapter 1)
2019-box: 22 (guest) => 2222 (host) (adapter 1)
==> 2019-box: Running 'pre-boot' VM customizations...
==> 2019-box: Booting VM...
==> 2019-box: Waiting for machine to boot. This may take a few minutes...
2019-box: WinRM address: 127.0.0.1:55985
2019-box: WinRM username: vagrant
2019-box: WinRM execution_time_limit: PT2H
2019-box: WinRM transport: negotiate
==> 2019-box: Machine booted and ready!
==> 2019-box: Checking for guest additions in VM...
2019-box: The guest additions on this VM do not match the installed version of
2019-box: VirtualBox! In most cases this is fine, but in rare cases it can
2019-box: prevent things such as shared folders from working properly. If you see
2019-box: shared folder errors, please make sure the guest additions within the
2019-box: virtual machine match the version of VirtualBox you have installed on
2019-box: your host and reload your VM.
2019-box:
2019-box: Guest Additions Version: 6.1.4
2019-box: VirtualBox Version: 5.2
==> 2019-box: Configuring and enabling network interfaces...
==> 2019-box: Mounting shared folders...
2019-box: /Users/ajoseph => /Users/ajoseph
==> 2019-box: Machine already provisioned. Run vagrant provision or use the --provision
==> 2019-box: flag to force provisioning. Provisioners marked to run always will still run.

The output doesn‘t show the provisioning script. You can run it again when the vm is running with

vagrant provision 2019-box

The idea is to write files in your home directory in the .docker folder to create the context files.

Let‘s see how that goes.

Hi Stefan, here is the provisioning output.
$ vagrant provision 2019-box
/opt/vagrant/embedded/gems/2.2.7/gems/vagrant-2.2.7/lib/vagrant/util/which.rb:37: warning: Insecure world writable dir /Volumes/SamsungUSB/work/windows-docker-machine in PATH, mode 040777
==> 2019-box: Running provisioner: shell...
2019-box: Running: scripts/create-machine.ps1 as c:\tmp\vagrant-shell.ps1
2019-box: Directory: C:\Users\vagrant
2019-box: Mode LastWriteTime Length Name
2019-box: ---- ------------- ------ ----
2019-box: d----- 6/1/2020 12:37 AM .docker
2019-box: Directory: C:\ProgramData\docker
2019-box: Mode LastWriteTime Length Name
2019-box: ---- ------------- ------ ----
2019-box: d----- 6/1/2020 12:37 AM certs.d
2019-box: === Generating CA
2019-box: === Generating CA public key
2019-box: === Generating Server certificate
2019-box: === Generating Server private key
2019-box: === Generating Client certificate
2019-box: === Generating Client key
2019-box: === Creating / Updating C:\ProgramData\docker\config\daemon.json
2019-box: Directory: C:\Users\vagrant.docker\machine\machines
2019-box: Mode LastWriteTime Length Name
2019-box: ---- ------------- ------ ----
2019-box: d----- 6/1/2020 12:37 AM 2019-box
2019-box: === Creating / Updating C:\Users\vagrant.docker\machine\machines\2019-box\config.json
2019-box: === Copying Client certificates to C:\Users\vagrant.docker\machine\machines\2019-box
2019-box: === Copying Docker Machine configuration to C:/Users/ajoseph.docker\machine\machines\2019-box
2019-box: Directory: C:\Users\vagrant.docker\contexts\meta
2019-box: Mode LastWriteTime Length Name
2019-box: ---- ------------- ------ ----
2019-box: d----- 6/1/2020 12:37 AM 626f71594ecefa7e7eaa6b2e89fe7cf815380f3168cf4c1db0cae5f4317a444e
2019-box: Directory: C:\Users\vagrant.docker\contexts\tls\626f71594ecefa7e7eaa6b2e89fe7cf815380f3168cf4c1db0cae5f4317a444e
2019-box: Mode LastWriteTime Length Name
2019-box: ---- ------------- ------ ----
2019-box: d----- 6/1/2020 12:37 AM docker
2019-box: === Creating / Updating
2019-box: === Copying Client certificates to C:\Users\vagrant.docker\contexts\tls\626f71594ecefa7e7eaa6b2e89fe7cf815380f3168cf4c1db0cae5f4317a444e\docker
2019-box: === Copying Docker Context configuration to C:/Users/ajoseph.docker\contexts\meta\626f71594ecefa7e7eaa6b2e89fe7cf815380f3168cf4c1db0cae5f4317a444e
2019-box: Restarting Docker
2019-box: Opening Docker TLS port
2019-box: Ok.

After that when I run I see the docker context created

$ docker context ls
NAME DESCRIPTION DOCKER ENDPOINT KUBERNETES ENDPOINT ORCHESTRATOR
2019-box 2019-box windows-docker-machine tcp://192.168.99.90:2376
default * Current DOCKER_HOST based configuration unix:///var/run/docker.sock https://192.168.64.4:8443 (default) swarm

Seems like I missed the provisioning part

I'm glad it works now. I don't know why ==> 2019-box: Machine already provisioned. Run vagrant provision or use the --provision was shown on the first vagrant up and where Vagrant stores that information.

Thank you for your help!

kaustav1996@entropy:~/Desktop/Abhartech Work/windows-docker-machine$ vagrant up --provider virtualbox 2019-box
Bringing machine '2019-box' up with 'virtualbox' provider...
==> 2019-box: Checking if box 'StefanScherer/windows_2019_docker' version '2020.09.22' is up to date...
==> 2019-box: Clearing any previously set forwarded ports...
==> 2019-box: Clearing any previously set network interfaces...
==> 2019-box: Preparing network interfaces based on configuration...
    2019-box: Adapter 1: nat
    2019-box: Adapter 2: hostonly
==> 2019-box: Forwarding ports...
    2019-box: 3389 (guest) => 3389 (host) (adapter 1)
    2019-box: 5985 (guest) => 55985 (host) (adapter 1)
    2019-box: 5986 (guest) => 55986 (host) (adapter 1)
    2019-box: 22 (guest) => 2222 (host) (adapter 1)
==> 2019-box: Running 'pre-boot' VM customizations...
==> 2019-box: Booting VM...
==> 2019-box: Waiting for machine to boot. This may take a few minutes...
    2019-box: WinRM address: 127.0.0.1:55985
    2019-box: WinRM username: vagrant
    2019-box: WinRM execution_time_limit: PT2H
    2019-box: WinRM transport: negotiate

Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.

If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.

If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.

If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.
kaustav1996@entropy:~/Desktop/Abhartech Work/windows-docker-machine$ 
kaustav1996@entropy:~/Desktop/Abhartech Work/windows-docker-machine$ vagrant provision 2019-box
==> 2019-box: Running provisioner: shell...
    2019-box: Running: scripts/create-machine.ps1 as c:\tmp\vagrant-shell.ps1
    2019-box: === Generating CA
    2019-box: === Generating CA public key
    2019-box: === Generating Server certificate
    2019-box: === Generating Server private key
    2019-box: === Generating Client certificate
    2019-box: === Generating Client key
    2019-box: === Creating / Updating C:\ProgramData\docker\config\daemon.json
    2019-box: === Creating / Updating C:\Users\vagrant\.docker\machine\machines\2019-box\config.json
    2019-box: === Copying Client certificates to C:\Users\vagrant\.docker\machine\machines\2019-box
    2019-box: === Copying Docker Machine configuration to C:/home/kaustav1996\.docker\machine\machines\2019-box
    2019-box: === Creating / Updating 
    2019-box: === Copying Client certificates to C:\Users\vagrant\.docker\contexts\tls\626f71594ecefa7e7eaa6b2e89fe7cf815380f3168cf4c1db0cae5f4317a444e\docker
    2019-box: === Copying Docker Context configuration to C:/home/kaustav1996\.docker\contexts\meta\626f71594ecefa7e7eaa6b2e89fe7cf815380f3168cf4c1db0cae5f4317a444e
    2019-box: Restarting Docker
    2019-box: Opening Docker TLS port
    2019-box: Ok.
kaustav1996@entropy:~/Desktop/Abhartech Work/windows-docker-machine$ docker context ls
NAME                DESCRIPTION                               DOCKER ENDPOINT               KUBERNETES ENDPOINT   ORCHESTRATOR
default *           Current DOCKER_HOST based configuration   unix:///var/run/docker.sock                         swarm

Above is my output. Provisioning done but still can't see it in docker context

But it is running in virtualbox

virtualvox