How to keep running vagrant machine after restart - vagrant

I have created a vagrant machine which is using the LAMP. So, every time I restart the computer I have to use vagrant up to run VM. Is this possible to keep running vagrant machine so when I restart the computer it should remain running in the background? As to keep running Docker container we use -d to detach it with the process. Is this possible in Vagrant?

Related

Why docker desktop is unable to start docker-backend?

Problem:
I started my system as usual but my docker-desktop doesn't work, WSL doesn't respond to commands and there is a process called "Vmmem" using 25% of my memory. I have tried a bunch of thing but nothing seems to work.
System Attributes:
Windows 10 Pro (10.0.19045.2486)
docker: 4.15
WSL: 1.0.3.0
More context:
Recently I was having trouble with my docker set up. I have one particular container that was "crashing" the docker. It was not throwing any exception but after some event (that I couldn't find out) all the other container where unreachable any attempt to stop/start another container would result on "Error: 500 failed to respond...". When this happens I usually just restart the system and everything works fine, but today it wasn't the case. I restarted and I noticed that I had the "Vmmem" process already running at 25% (it usually just reaches this point at the end of the day), the docker desktop could not start the docker backend and when I tried running wsl -l -v I got no response. I can use some docker commands like docker -v but the docker compose up doesn't work at all.
What I've tried:
restart the system again (nothing changed, still starting with 25% mem usage)
deactivating Hyper-V (nothing happened)
stop/start docker service using net start/stop <service> (it gives a response but didn't solve the problem)
Uninstall docker-desktop (it crashes before even starting the uninstall process)
Terminate WSL wsl -t Ubuntu (got no response from wsl)
Overwrite installation with Docker 4.16 (it gets stuck on "Preparing for update... / Stopping VM and preparing for update")
Forcefully kill the "Vmmem" (I've got Access denied error)
Edit 1:
I managed to finally install the Docker desktop 4.16 but the problem continues, system starts with 25% Vmmem memory usage and docker desktop is not able to initiate backend.
the process Vmeem It represents the memory and CPU consumed by the combination of all the virtual machines running on your Windows PC, there is a possibility that processes are still running on your PC. I recommend you try to launch these commands from the console:
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
This will stop all containers and delete them.
If this doesn't work, I recommend you enter your bios settings and disable virtualization, that way those processes will stop, then you can enable it again and try. I wish you luck and I hope this resolves.
Steps that I did to be able to stop "Vmmem" process and install docker desktop again:
disable Hyper-V
disable virtualization (BIOS)
restart system
to this point the "Vmmem" problem was gone
uninstall docker desktop
rm all wsl instances
enable Hyper-V
enable hypervisorlaunchtype
restart system
enable virtualization (BIOS)
install wsl Ubuntu instance
install Docker Desktop
Maybe some steps listed here are redundant but that is what I did. hope it helps if other people is passing through the same problem

Forgetting a VM in Vagrant

I've started a VM on Google Compute Engine using Vagrant with the vagrant-google provider. I no longer wish to control the VM using Vagrant, but I would like it to keep running without me interrupting it.
What's the proper way to have Vagrant "forget" about this machine?
so the instance has been installed on GCE and you can control directly from there.
Locally you can delete the .vagrant folder that vagrant created in the folder when you launch it
After this to remove references you can run vagrant global-status --prune which will remove invalid entries and clean vagrant conf file from this machine

Run vagrant box in background without a prompt

I have a Cassandra instance running inside virtualbox using vagrant in my windows PC, And my other dev/application settings are in another VM. I don't always need a prompt/UI/CI for the cassandra vm because it's confusing to switch between, is there a way to bring the vagrant without a UI/CI prompt?
Now i'm ding vagrant up

Running virtualbox/vagrant in a cloud instance

I've tried two things:
First, I tried to install virtualbox on a EC2 machine, which proved to be impossible.
Second, I was able to install both vagrant and virtualbox on a Digital Ocean droplet, but when I tried to run vagrant up, it got stuck on Booting VM.
Several sources on Internet say that it is not possible to run a VM inside a virtualized environment (both Amazon and Digital Ocean provide this).
Is there any way I can solve this with another provider, or is there a way to run vagrant/virtualbox in Amazon or Digital Ocean?
Install VirtualBox and Vagrant on a physical machine such as your desktop
Run the 3 commands from the command line:
vagrant init somenameyoumakeup file://urlToYour.box
vagrant up
vagrant halt
Open the VirtualBox UI
Export the Virtual machine to OVA format using the File -> Export menu
Follow the guide here for importing an OVA: https://aws.amazon.com/ec2/vm-import/

How to keep Vagrant box running in background?

Instead of running a vagrant box in the background (via vagrant ssh in a terminal shell), is there a way to run it using a daemon? This could be used for having people connect to your box (via vagrant connect).
Right now I'm just having a terminal window stay on vagrant share --ssh.
I can't do
vagrant share --ssh &
because it requires my password and I couldn't put in my password.
In essence, whenever you start a Vagrant box with vagrant up, it will already be running in the background (in VirtualBox or VMWare, for example). You don't need to worry about keeping an ssh session connected to it.

Resources