Running Docker Desktop on AWS EC2 Virtual Machine (Windows server 2022) - docker

Im trying to set up docker desktop on my EC2 virtual machine running windows server 2022. But the program just crashes a few seconds after it starts. Im guessing virtualization is not enabled. Any suggestions to what could be the problem?
I tried to install Hyper-V but that is not working either.

Related

How to run linux and windows container on docker running in windows server 2022?

How to run linux and windows container on docker running in windows server 2022?
It is possible with lcow but this is deprecated now.
When running in experimental mode it is working because of lcow, but this is deprecated now.
To run windows containers on windows server read this, looks like a step-by-step howto: https://learn.microsoft.com/en-us/virtualization/windowscontainers/about/
To run linux containers on windows server, well, you could do WSL2 on windows server to have a linux in a minivm and install docker on it, but whats the point, I would not bother with it, just get a linux server for linux containers.

Can i use Docker Desktop to manage a VPS running Docker?

I am very new to Docker as a whole.
I have a VPS with Debian 10 Buster, running Docker. I also installed Docker Desktop on my windows 10 pc. I like the GUI, and I googled if i can manage my VPS docker with this application, but found no answear.
Is this possible, or am i missing something obvious?
While I have not been able to connect the Windows 10 Docker Desktop application to my Docker engine running on my Debian 10 VPS, I found an alternative:
portainer.io
This is a service, with a free plan option(CE). You install this docker image following their documentation, and it runs on the host machine, in my case, the Debian VPS. I use this image on port 9000, so all I have to do to access it is open a browser and navigate to http://HOSTIPADDRESS:9000.
There you will find a gui similar to the Docker Desktop application.

Running docker for windows for local development with an Ubuntu OS in production

My production instance is running under Ubuntu 16 while my local machine runs under Windows 10.
In order to have a setup close to my production, I use VMs (vagrant, virtualbox, homestead). Btw, my application is a Laravel app so homestead is the route to go as per its documentation.
Since I have multiple applications that have different specifications (different OS version, different app versions), I need to set multiple VMs as well. Since VMs are resource-heavy, it tends to slow down my machine in time.
That then, I came across Docker. Will Docker for Windows and create containers and images base on my app's specification suffice or do I still need a VM then create docker containers from there?
Below is a diagram
Windows running Docker for Windows
Windows running Ubuntu VM with Docker
Docker-Desktop will by default start and run a Linux VM in the background of your Windows System.
https://docs.docker.com/docker-for-windows/install/
Hyper-V and Containers Windows features must be enabled.
You can also use WLS/2 which is basically the same thing.
https://docs.docker.com/docker-for-windows/wsl/
Jens

Docker: Why use Linux containers on Windows?

I am using Win 10 Pro N (Version 1709) as a development machine and Windows Server 2016 Standard (Version 1607) as production server.
I am currently developing an ASP.NET Core 2 application with MongoDb as database.
A couple days ago I first stumbled over the idea, to run MongoDb as a Docker image.
I don't have any experience with Docker so far, but I managed to switch from Linux containers (default) to Windows containers on Windows machines.
Was this a good decision? Or is there any reason why I should use Linux containers instead of Windows containers in my scenario?
What e.g. if I should decide to deploy my application to a Linux server some time? In this case, would it wiser to start with Linux containers right from the beginning?
Docker is not about virtualization but more about isolation.
A windows container will run on a windows host
A linux container will run on a linux host
Then some people wanted to run linux container on windows
First you needed to create a linux vm on windows to run the container
Now you can use LinuxKit to run the container but it's still a light VM
Then some people wanted to run windows container on linux
First you needed to create a windows vm on linux to run the container
Now you can use nothing more as of today
So the best bet is to start with a container aimed at your production servers
If you want to deploy to linux I would advise using linux containers since you then test a more similar setup and are more likely to find issues that will also show in your final deployment.
Other than that linux container technology is more mature and better supported than windows containers.

Can I run Docker in a Virtual Machine?

I tried to run Docker on a virtual machine.
Host : MacBook
VM : Parallels Windows 7
And error occurs:
Is it possible?
If the VM is a Linux, you can do this without any problem - on Linux, the Docker is essentially a well-worked chroot. Thus, the Linux docker is not virtualization.
In the case of Windows, it is not so easy. Windows Docker internally uses Hyper-V to emulate the containers. Which means that you can only run, if you can use nested virtualization:
On your host machine runs a Windows VM
Inside your Windows VM, runs a HyperV
HyperV is managed by the docker installed on your virtual Windows.
I tried qemu/kvm, virtualbox and vmware player. I configured them deeply and strongly, I've hacked them, I did every possible to do. Only the last worked (VMWare).
There are significant speed costs, but it may be useful for development on Linux, and then trial-test on Windows configurations.
You will need a lot of ram. At least 16G. 32G is better. A relative useful configuration would be:
32GB physical RAM for the physical host
12GB virtual RAM for the Windows VM running on it
8GB virtual RAM inside the Windows VM for the HyperV Linux host.
Sometimes it will be a little bit buggy, but only your HyperV will crash out, your virtual Win, or your host machine won't. It is okay for testing a docker container on a Windows machine, what you've developed on a Linux. Don't create mission critical servers on this way. :-)
You're using Docker Machine in your Windows VM, which is actually going to create a Linux VM inside the Windows VM on your Mac. You can do that, but you need to enable nested virtualization - which I'm not sure you can do in Parallels 7.
Instead you can run Docker Machine on the Mac directly and use Parallels to create the Linux VM - which means Docker is running in a Linux VM on your Mac, and you don't need nested virtualization.
Or preferably use Docker for Mac if your OS supports it, it's the latest product and has much better host integration than Docker Machine.
If you would be using Windows 10/11 Pro or Enterprise and Hyper-V, then all you must do is to enable nested virtualization. On your host, just run (with your guest off):
> Set-VMProcessor -VMName <VMName> -ExposeVirtualizationExtensions $true
Now you can start your guest and run Docker Desktop as normal.
According to Docker's terms I don't think it's allowed. Section 4.1(b)(vii) says you shall not "use the Service on virtual machines." For clarification, "'Service' refers to the applications, software (including any Open Source Software), products and services provided by Docker, including any beta or trial versions."
If I am reading this right, that means it's illegal to run Docker on any VM.
Worked perfectly fine. Base OS win 10 pro with VirtualBox Version: 6.1 and vagrant with ubuntu 20.04. Using vagrant box follow docker instructions. With vagrant public network no need for port forwarding all apps were accessible.
Previous persons comment is very concerning considering on Windows and Mac you run docker inside a virtual machine lul. Windows uses WSL2 and Mac uses an arm linux machine to manage its docker.
Also, you can run docker in a vm, but it must be linuxOS vm as windows 7 does not support docker.

Resources