Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot connect to port 2376 when using 2019-box context #98

Open
antoinell opened this issue Jan 26, 2025 · 2 comments
Open

cannot connect to port 2376 when using 2019-box context #98

antoinell opened this issue Jan 26, 2025 · 2 comments

Comments

@antoinell
Copy link

Thanks for creating this useful repository. I tried to use it today on Mac in order to be able to spin up a Windows Docker container and had the following problem

git clone https://github.com/StefanScherer/windows-docker-machine
brew install --cask vagrant  
brew install --cask virtualbox  
vagrant up --provider virtualbox 2019-box
docker context use 2019-box
docker version
Client:
Version:           27.4.0
API version:       1.47
Go version:        go1.22.10
Git commit:        bde2b89
Built:             Sat Dec  7 10:35:43 2024
OS/Arch:           darwin/amd64
Context:           2019-box
error during connect: Get "https://192.168.59.51:2376/v1.47/version": dial tcp 192.168.59.51:2376: connect: no route to host
@antoinell
Copy link
Author

I ran a netstat command and here was the output

antoine@antoines-air my-react-app % netstat -an | grep 2376
tcp4       0      0  192.168.59.1.57120     192.168.59.51.2376     ESTABLISHED
tcp4       0      0  192.168.59.1.57119     192.168.59.51.2376     ESTABLISHED
tcp4       0      0  192.168.59.1.57117     192.168.59.51.2376     ESTABLISHED
tcp4       0      0  192.168.59.1.57113     192.168.59.51.2376     ESTABLISHED
tcp4       0      0  192.168.59.1.57111     192.168.59.51.2376     ESTABLISHED
tcp4       0      0  192.168.59.1.57081     192.168.59.51.2376     ESTABLISHED
tcp4       0      0  192.168.59.1.57079     192.168.59.51.2376     ESTABLISHED
tcp4       0      0  192.168.59.1.56962     192.168.59.51.2376     ESTABLISHED
tcp4       0      0  192.168.59.1.56959     192.168.59.51.2376     ESTABLISHED
tcp4       0      0  192.168.59.1.56958     192.168.59.51.2376     ESTABLISHED
tcp4       0      0  192.168.59.1.56952     192.168.59.51.2376     ESTABLISHED
tcp4       0      0  192.168.59.1.56951     192.168.59.51.2376     ESTABLISHED

The installation of the vagrant machine gave this output

antoine@antoines-air windows-docker-machine % vagrant up --provider virtualbox 2019-box
Bringing machine '2019-box' up with 'virtualbox' provider...
==> 2019-box: Box 'StefanScherer/windows_2019_docker' could not be found. Attempting to find and install...
    2019-box: Box Provider: virtualbox
    2019-box: Box Version: >= 0
==> 2019-box: Loading metadata for box 'StefanScherer/windows_2019_docker'
    2019-box: URL: https://vagrantcloud.com/api/v2/vagrant/StefanScherer/windows_2019_docker
==> 2019-box: Adding box 'StefanScherer/windows_2019_docker' (v2021.05.15) for provider: virtualbox
    2019-box: Downloading: https://vagrantcloud.com/StefanScherer/boxes/windows_2019_docker/versions/2021.05.15/providers/virtualbox/unknown/vagrant.box
==> 2019-box: Successfully added box 'StefanScherer/windows_2019_docker' (v2021.05.15) for 'virtualbox'!
==> 2019-box: Preparing master VM for linked clones...
    2019-box: This is a one time operation. Once the master VM is prepared,
    2019-box: it will be used as a base for linked clones, making the creation
    2019-box: of new VMs take milliseconds on a modern system.
==> 2019-box: Importing base box 'StefanScherer/windows_2019_docker'...
==> 2019-box: Cloning VM...
==> 2019-box: Matching MAC address for NAT networking...
==> 2019-box: Checking if box 'StefanScherer/windows_2019_docker' version '2021.05.15' is up to date...
==> 2019-box: Setting the name of the VM: windows-docker-machine_2019-box_1737854074683_47735
Vagrant is currently configured to create VirtualBox synced folders with
the `SharedFoldersEnableSymlinksCreate` option enabled. If the Vagrant
guest is not trusted, you may want to disable this option. For more
information on this option, please refer to the VirtualBox manual:

  https://www.virtualbox.org/manual/ch04.html#sharedfolders

This option can be disabled globally with an environment variable:

  VAGRANT_DISABLE_VBOXSYMLINKCREATE=1

or on a per folder basis within the Vagrantfile:

  config.vm.synced_folder '/host/path', '/guest/path', SharedFoldersEnableSymlinksCreate: false
==> 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.22
    2019-box: VirtualBox Version: 7.1
==> 2019-box: Configuring and enabling network interfaces...
==> 2019-box: Mounting shared folders...
    2019-box: /Users/antoine => /Users/antoine
==> 2019-box: Running provisioner: shell...
    2019-box: Running: scripts/create-machine.ps1 as C:\tmp\vagrant-shell.ps1
    2019-box: 
    2019-box: 
    2019-box:     Directory: C:\Users\vagrant
    2019-box: 
    2019-box: 
    2019-box: Mode                LastWriteTime         Length Name
    2019-box: ----                -------------         ------ ----
    2019-box: d-----        1/25/2025   5:15 PM                .docker
    2019-box: 
    2019-box: 
    2019-box:     Directory: C:\ProgramData\docker
    2019-box: 
    2019-box: 
    2019-box: Mode                LastWriteTime         Length Name
    2019-box: ----                -------------         ------ ----
    2019-box: d-----        1/25/2025   5:15 PM                certs.d
    2019-box: 
    2019-box: === Generating CA
    2019-box: 
    2019-box: === Generating CA public key
    2019-box: 
    2019-box: === Generating Server certificate
    2019-box: 
    2019-box: === Generating Server private key
    2019-box: 
    2019-box: === Generating Client certificate
    2019-box: 
    2019-box: === Generating Client key
    2019-box: 
    2019-box: === Creating / Updating C:\ProgramData\docker\config\daemon.json
    2019-box: 
    2019-box: 
    2019-box:     Directory: C:\Users\vagrant\.docker\machine\machines
    2019-box: 
    2019-box: 
    2019-box: Mode                LastWriteTime         Length Name
    2019-box: ----                -------------         ------ ----
    2019-box: d-----        1/25/2025   5:16 PM                2019-box
    2019-box: 
    2019-box: === Creating / Updating C:\Users\vagrant\.docker\machine\machines\2019-box\config.json
    2019-box: 
    2019-box: === Copying Client certificates to C:\Users\vagrant\.docker\machine\machines\2019-box
    2019-box: 
    2019-box: === Copying Docker Machine configuration to C:/Users/antoine\.docker\machine\machines\2019-box
    2019-box: 
    2019-box: 
    2019-box:     Directory: C:\Users\vagrant\.docker\contexts\meta
    2019-box: 
    2019-box: 
    2019-box: Mode                LastWriteTime         Length Name
    2019-box: ----                -------------         ------ ----
    2019-box: d-----        1/25/2025   5:16 PM                626f71594ecefa7e7eaa6b2e89fe7cf815380f3168cf4c1db0cae5f4317a444e
    2019-box: 
    2019-box: 
    2019-box:     Directory: C:\Users\vagrant\.docker\contexts\tls\626f71594ecefa7e7eaa6b2e89fe7cf815380f3168cf4c1db0cae5f4317a444e
    2019-box: 
    2019-box: 
    2019-box: Mode                LastWriteTime         Length Name
    2019-box: ----                -------------         ------ ----
    2019-box: d-----        1/25/2025   5:16 PM                docker
    2019-box: 
    2019-box: === Creating / Updating
    2019-box: 
    2019-box: === Copying Client certificates to C:\Users\vagrant\.docker\contexts\tls\626f71594ecefa7e7eaa6b2e89fe7cf815380f3168cf4c1db0cae5f4317a444e\docker
    2019-box: 
    2019-box: === Copying Docker Context configuration to C:/Users/antoine\.docker\contexts\meta\626f71594ecefa7e7eaa6b2e89fe7cf815380f3168cf4c1db0cae5f4317a444e
    2019-box: Restarting Docker
    2019-box: Opening Docker TLS port
    2019-box: Ok.
    2019-box: 
    2019-box: 
    2019-box: 

@antoinell
Copy link
Author

It looks like it is a networking issue and I would need to use this tutorial https://jekhokie.github.io/linux/vagrant/networking/2020/07/25/vagrant-network-connectivity-and-routes.html in order to add a route to the subnet used by vagrant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant