How to fix docker-machine ip? - windows

I am running a Docker container with docker-toolbox for windows and i am struggling to access it.
I can only access my container from the physical host and while using a LAN IP such as 192.168.x.x.
I want to fix this situation somehow, what are my options ?

This problem is only seen when docker-toolbox is needed and on window versions that use hyper-v by default (such as Windows Server 2012 RC2 and similars).
The problem is that VirtualBox and Hyper-V cannot co-exist on the same machine. Only one hypervisor can run at a time, and since Hyper-V runs all the time, while VirtualBox only runs when it is launched, VirtualBox is the loser in this scenario.
There are 2 possible solutions:
disable hyper-v:
open cmd as admin and type: bcdedit /set hypervisorlaunchtype off
configure virtual box to use hiper-v aswell

Related

Can Vagrant be used with Windows Hyper-V Server?

Is it possible to tell Vagrant to use a Windows Hyper-V Server as a host? I am currently using Vagrant for developing locally, which uses my development machine as the host.
The documentation for Vagrant mentions networking and ssh; however, this is almost always in the context of networking from the guest machine out. I am wondering how to run Vagrant on my desktop machine, and provision instances on the Windows Hyper-V Server.
Follow this step-by-step guide...
https://dogcomp.medium.com/speed-up-laravel-8-homestead-with-hyper-v-step-by-step-guide-99505199d003
The vagrant box provisioned is exposed in the local LAN subnet, as long as your firewall configured properly, you should be able to access via SSH/HTTP. However, you need to run vagrant command on the server.

Docker on Windows 10 Home

My question is: If you use Docker tool box (that is required for windows 10 home to run Docker) you are essentially using a virtual machine (vm)?
If you are using a vm already the only reason to use docker from that point is to save on many more multiple instances?
Meaning if you only want 1 extra (guest instance): you can have a vm. Though, with docker (toolbox on windows 10 home) you would have 1 vm and it runs docker?
The only way that is useful is if you want many more instances as in: 1 vm + 1 docker or + 1000 more dockers?
Or am I missing something?
Yes, docker toolbox uses Oracle VirtualBox cause Windows 7, 8, and Windows 10 home cannot use Hyper V. And yes, If you are using a VM already the only reason to use docker from that point is to save on many more multiple instances but it also allows easy backup and deployment. But you are losing a decent amount of memory when running a VM and then even more when you are running docker.
So although Docker CE will tell you your Windows doesn't support Hyper-V, this isn't always the case (if you check in System Info you might have Hyper-V enabled, if you're on an Insider build or many builds on GPU computers after Anniversary update then you probably have Hyper-V on Windows 10 Home). There are a few workarounds until the Docker team addresses this issue.
You could use Docker from inside WSL (Windows Subsystem for Linux). Microsoft claims WSL accesses everything directly without Hyper-V so this should be theoretically at the same speed. Of course you can't use your GPU at all because of limitations with GPU passthrough on WSL, which you can ask to be resolved here.
You can also use Docker Toolbox as the other answer stated with Virtualbox, but this will be inherently much slower as you're virtualizing a container inside a virtualized container. You should be able to theoretically get GPU support through this, as well as other features e.g. GUI that you wouldn't be able to with WSL.
To answer the "usefulness" portion of the question:
It's also useful if you run code on a server, but need to develop/debug/update it. You want to test it locally, but to make sure the environment in which it executes is the same (to avoid unexpected, environment specific behavior), you use Docker both locally and on the server. In such a case, even though it's slow, I'll spin up a VM on my W10 Home laptop and run Docker in it.
The greatest feature of the Windows 10 Home May 2020 Update is Windows Subsystem for Linus 2. You can docker in it without the need for a complete virtual machine as in Virtual Box.
Install Docker Desktop that it will automatically indentify WSL2.

Docker for Windows error: "Hardware assisted virtualization and data execution protection must be enabled in the BIOS"

I've installed Docker and I'm getting this error when I run the GUI:
Hardware assisted virtualization and data execution protection must
be enabled in the BIOS
Seems like a bug since Docker works like a charm from the command line, but I'm wondering if anyone has a clue about why this is happening?
Before you ask, yes, I've enabled virtualization in the BIOS and the Intel Processor Identification Utility confirms that it's activated. Docker, docker-machine and docker-compose all work from the command line, Virtualbox works, running Docker from a Debian or Ubuntu VM works.
There's just this weird issue about the GUI.
My specs:
Windows 10 Pro x64 Anniversary Edition
Intel core i5-6300HQ # 2.30GHz
If the features described are enabled, the problem is with Hyper-V that is disabled or Hypervisor agent not running.
SOLUTION A (If Hyper-V is totally disabled or not installed)
Open PowerShell as administrator and
Enable Hyper-V with
dism.exe /Online /Enable-Feature:Microsoft-Hyper-V /All
SOLUTION B (If Hyper-V feature is already enabled but doesn't work)
Enable Hypervisor with
bcdedit /set hypervisorlaunchtype auto
Now restart the system and try again.
SOLUTION C
If the problem persists, probably Hyper-V on your system is corrupted, so
Go in Control Panel -> [Programs] -> [Windows Features] and completely uncheck all Hyper-V related components. Restart the system.
Enable Hyper-V again. Restart.
NOTE 1:
Hyper-V needs hardware virtualization as prerequisite. Make sure your PC supports it, if yes and still won't work, there is the possibility your BIOS is not configured correctly and this feature is disabled. In this case, check, enable it and try again. The virtualization features could be reported under different names according the platform used (e.g if you don't see any option that uses virtualization label explicitly, on AMD you have to check SVM feature state, on Intel the VT-x feature state).
NOTE 2:
Hyper-V can be installed only with some version e.g.:
Windows 10 Enterprise; Windows 10 Professional; Windows 10 Education.
Hyper-V cannot be installed on cheaper or mobile Windows versions e.g.:
Windows 10 Home; Windows 10 Mobile; Windows 10 Mobile Enterprise.
Below is working solution for me, please follow these steps
Open PowerShell as administrator or CMD prompt as administrator
Run this command in PowerShell-> bcdedit /set hypervisorlaunchtype auto
Now restart the system and try again.
cheers.
In my case I had to enable virtualization in the BIOS setting.
Restart PC
While you are on the 'restart' screen press any of these keys and you enter the bios settings in windows: esc, f1, f2, f3, f4, f8 or delete
For intel based systems:
press f7 (advanced mode)
go to advanced
cpa configuration
enable virtualization
And after all above steps, it finally works :-)
Note: If your version of Windows supports Hyper-V, you can install docker directly by selecting Use Hyper-V during installation.
However, if your Windows does not have this support, follow the solution below.
I had a similar problem.
I have enabled Intel Virtual Technology in the bios settings.
Then I updated the Linux kernel from here.
and it worked
My specs:
Microsoft Windows 10 Home x64 Single Language
Intel(R) Core(TM) i5-7300 # 2.50GHz
I uninstalled Intel HAXM and VirtualBox, Docker now runs
For me, all I had to do it uninstalling VMware.
Docker now is running
Open the task manager and click on the performance tab. If virtualization is disabled, you need to follow the instructions here to enable it: https://blogs.technet.microsoft.com/canitpro/2015/09/08/step-by-step-enabling-hyper-v-for-use-on-windows-10/
If solution above does not work, then
Go to command prompt and type systeminfo. check Hyper-V Requirements section.
If all listed Hyper-V requirements have a value of Yes, your system can run the Hyper-V role.
In my case virtualization enable in Firmware was NO.
So, I did enabled in system bios by making Virtualization Technology enabled in my HP laptop.
Please visit this link to enable it:
https://2nwiki.2n.cz/pages/viewpage.action?pageId=75202968
Try these steps
Run this command in powershell
bcdedit /set hypervisorlaunchtype
auto
Restart your PC
Now try docker --version in cmd line
Can you try enabling Hyper-V manually, and potentially creating and running a Hyper-V VM manually? Details:
https://docs.docker.com/docker-for-windows/#/what-to-know-before-you-install
https://msdn.microsoft.com/en-us/virtualization/hyperv_on_windows/quick_start/walkthrough_install
Enable the Hyper-V role through Settings
Right click on the Windows button/Icon and select ‘Apps and Features’.
1- Select Programs and Features on the right under related settings.
2- Select Turn Windows Features on or off.
2- Select Hyper-V and click OK.
follow the steps bellow:
go to: windows setting => Update & Security => Recovery => Advanced Startup and click on : Restart Now.
Troubleshoot => Advanced Option => UEFI Firmware => Restart.
go to Bios => configuration => Virtualization technology => enable it.
save change and it will works.
It helped me:
Disable components Virtual Machine Platform and Windows Subsystem for Linux
Restart
Enable components
Restart
I think my problem was related to beta version of WSL2.
I tried to install android subsystem. But I have deleted it some time ago. So, there was only beta WSL2 left
In my case I had to uninstall hyper-v, restart pc, and run docker again.
Try this in PowerShell(admin enabled):
Enable-WindowsOptionalFeature –Online -FeatureName Microsoft-Hyper-V –All -NoRestart
This will install HyperVisor without management tools, and then you can run Docker after this.
I also use vagrant. It appears I can only use 1 thing at a time. Uninstalling vagrant/virtualBox allowed me to run docker and vise versa
I have tried many suggestions above but docker keeps complaining about hardware assisted virtualization error. Virtualization is enabled in BIOS, and also Hyper-V is installed and enabled. After a few try and errors, I eventually downloaded coreinfo tool and found out that Hypervisor was not actually enabled. Using ISE (64 bit) as admin and run command from above Solution B and that enables Hypervisor successfully (checked via coreinfo -v again). After restart, docker is now running successfully.
If everything is fine with BIOS option I just forced disabling and enabling all HyperV features and this solved my issue
--cmd
Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All
--restart
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V –All
In my case even though I used all the solutions mentioned above but nothing worked for me. So I decided to uninstall docker and install it again.
Now in the process, I have noticed that I did not check Use Windows containers instead of Linux containers (this can be changed after installation) in my previous installation, and that is why I got the problem above and the solutions still did not fix it. So ensure to check it before you run desktop docker or uninstall it and install it again by checking this option.
I had the same issue after installing VMWare, I uninstalled it but this didn't fix the issue.
Solution for me: in "Turn windows features on or off" I turned off:
hyper-v
containers
windows subsystem for linux
then restart
After the restart I got this message from docker:
I ran the ran the command as said in the message
Enable-WindowsOptionalFeature -Online -FeatureName $("VirtualMachinePlatform", "Microsoft-Windows-Subsystem-Linux")
Then restart and voilà, Docker was back with WSL2
For me, disabling and then enabling Virtualisation in BIOS helped, strangely.
Issue for me was solved when I uninstalled Cygwin.
I tried many of the suggestions here, but did not manage to get it running. What worked for me in the end was to go straight in to the BIOS to activate it. The following article was of great help:
https://www.nextofwindows.com/how-to-enable-configure-and-use-hyper-v-on-windows-10
#Silverstorm
I had Hyperv installed and virtualization enabled in my BIOS.
But SOLUTION A didn't work for me.
However, SOLUTION B worked like a charm.
SOLUTION B (If Hyper-V feature is already enabled but doesn't work)
Enable Hypervisor with
bcdedit /set hypervisorlaunchtype auto
Now restart the system and try again.
Besides the original answer, I have done the following:
Disable Hyper-V in Windows Features
Turning virtualization off and on in BIOS
Log back in windows, enabled Hyper-V. I was prompted there are updates for Hyper-V and I did the update. Restart when prompted.
It worked!
If the problem persists probably Hyper-V on your system is corrupted, so
Go in Control Panel -> [Programs] -> [Windows Features] and completely uncheck all Hyper-V related components. Restart the system.
Enable Hyper-V again. Restart.
In my case virtualization is disabled so I need to do some configuration in my bios,
Please check following link I think it will help you to make bios setup
https://support.bluestacks.com/hc/en-us/articles/4409279876621-How-to-enable-Virtualization-VT-on-Windows-11-for-BlueStacks-5
In bios the setting are dependent on your system manufacture so please find setting accordingly.
Hope it will help you and save your time.
Thanks :)
On AMD machines the BIOS setting you have to change might be called SVM Mode. That was the case for my Gigabyte X570 board.
Setting is found in BIOS at: Advanced mode -> Tweaker -> Advanced CPU Settings -> SVM mode (set to enabled)
AMD-V is the renamed trademark for Secure Virtual Machine Mode (SVM).
I don't know how this works, and I don't even know what these commands do, I don't know what is hypervisor or what it does that it interferes with Docker, and I don't know what the nx means in the second command which it is apparently turning it off. I had these commands saved on my computer as "Turn VT-x off" (yet another thing that I don't know what it is, I think it's related to Virtualization Technology which I don't know what that does/is either). But nothing else worked for me (including the accepted answer (which I tested all of it's solutions) and other upvoted answers, although I didn't read all of them), except running both of these. It is completely up to you to test these, I do not guarantee any fixes to you, but it worked for me, I put it in here because I thought it might be helpful for someone else like me who also didn't find other answers to be that helpful:
bcdedit /set hypervisorlaunchtype auto
bcdedit /set nx AlwaysOff
shutdown /s
On 10th Jan'2023, I faced the same issue. After that, I untick windows subsystem for Linux and Hyper-v and restart my pc. Then I open the docker desktop and when it notify me to turn on Hyper-v then I did that and after that, it was working well.

Is there a way to psexec into my own virtual machine (windows xp mode)?

I am trying to run commands on the cmd prompt of my windows xp mode virtual machine from my main computer which is in windows 7. I've tried to look at the name of the windows xp mode computer which is virtualXP-63912, so i tried : "psexec \\virtualXP-63912 cmd" but it doesn't work. Any ideas of how I can get this to work?
As seen here, you need to change your VM from 'NAT' mode, which allows for web access but no local network connectivity (which is what you need to be able to psexec or run remote powershell commands on your XP mode VM, and also to be able to access the \computername\admin$ share, which is what PSExec uses for remoting) to NIC mode, which will bridge your VM to the network, and give it a local routable IP address.
In short, open the Windows XP Mode console, select your XP Mode Vm and go to settings, then change the network setting to bridged, as discussed in this post from Microsoft on the issue.
Finally, if I may suggest it, move off of XP Mode. It's not supported well these days and the new replacement, Hyper-V for Windows 8.0 and above is built-in to the desktop OS and is much, much more feature filled. You can copy and paste from your desktop into a VM, and run machines with Linux, even OSX on your Windows machine.

Hadoop virtual machine: can't connect

I've downloaded and extracted the Hadoop virtual machine from http://developer.yahoo.com/blogs/hadoop/posts/2010/10/yahoo-cloud-virtual-machine-appliance/. I've started this up in VMWare Player on Windows 7, and logged in.
However, I can't then connect to the IP address shown for the VM through SSH, nor can I ping it. What could be wrong?
Solution was to power off the VM, go to the VM settings, and select Network Adapter->Bridged.
what errors are you seeing?
if it is related to 64bit settings (commonly happens when you run it on vmware player), you need to enable it in your BIOS settings and reboot the VM.

Resources