Ssh into container into virtual box vm

hi there,
because of some really strange things happening where i lost a complete database, i know have to do the following:

  • i have a clone of my “local-by-flywheel” machine in virtualbox
  • i can start that clone in virtualbox and get presented with a terminal window logged in as root@local-by-flywheel
  • in the terminal i want to get to one of my local machines
  • and there to the database, to restore it (maybe by exporting it as sql files)

my question is: how do i get to the database this way?

(note: this is the only way because sadly i can’t start the vm the “normal” way (starting local) because there is and was a known error with tls certificates not getting fixed and the docker daemon not starting. i tried a lot of things posted in the forums here, but nothing worked)

best regards and thanks for any help,
andreas

@ageibert,

So sorry for the trouble!

Logging in requires an SSH key. There isn’t a default root password for the VM.


Any commands mentioned below should be ran in Terminal (or your preferred terminal) on macOS and Cmd.exe on Windows.

Here’s what I’d do in this case:

1. Create a new Docker Machine.

The command will look something like DOCKERMACHINEPATH create recovery-vm --driver virtualbox

Replace DOCKERMACHINEPATH with the appropriate path below.

  • macOS: "/Applications/Local by Flywheel.app/Contents/Resources/extraResources/virtual-machine/vendor/docker/osx/docker-machine" (there’s a space in this path so the quotes are required)
  • Windows: %LocalAppData%\Programs\local-by-flywheel\resources\extraResources\virtual-machine\vendor\docker\windows\docker-machine.exe

2. Shut down the newly created VM

You can do this in either VirtualBox or with docker-machine by running DOCKERMACHINEPATH stop recovery-vm

3. Swap out the disk for recovery-vm with the cloned VM

Browse to ~/.docker/machine/machines/recovery-vm and swap disk.vmdk with the disk.vmdk file of the recovery VM.

4. Start up recovery-vm with DOCKERMACHINEPATH start recovery-vm

5. Connect to recovery-vm with Docker

  • Run DOCKERMACHINEPATH env recovery-vm
  • Copy and run the command that it provides. On macOS, it’ll look something like eval $(DOCKERMACHINEPATH start recovery-vm)
  • Run DOCKERPATH ps -a to list out all of the Docker containers. See below for the DOCKERPATH
    • macOS: "/Applications/Local by Flywheel.app/Contents/Resources/extraResources/virtual-machine/vendor/docker/osx/docker"
    • Windows: %LocalAppData%\Programs\local-by-flywheel\resources\extraResources\virtual-machine\vendor\docker\windows\docker.exe
  • From there, you can start up the appropriate container and run the necessary commands.

Let me know if you have any questions or need clarification.