A
A
AlexanderY2017-10-22 07:36:26
virtual box
AlexanderY, 2017-10-22 07:36:26

Painless migration from vagrant to docker on Windows?

Why do I need this : I want to simplify my life even more. Vagrant is cool, but if you change something in the config, or update some packages, you need to remember to do it in production as well, and I often forget. If I understand correctly, one of the docker features is an easy deployment of the container, in which the software and configs will be identical to those used during development.
Another cool feature that is more difficult to implement with Vagrant is the quick replacement of some packages (php, nginx etc) to check if the bug is gone, if performance has improved, if backward compatibility has broken, etc.
snagA: All my current and past projects use Virtualbox as a provider to Vagrant. Docker requires Hyper-V. And Virtualbox and Hyper-V are incompatible for obvious reasons. That is, if you enable Hyper-V support, Virtualbox will not start.
I would love to start a new project using Docker. But you also need to support old projects. Turning Hyper-V on and off every time and rebooting the host machine is not an option. There are two options left:

  1. Use docker-machine: I'll try it if other options don't work. Because, in fact, this is running Docker in Virtualbox, hence the performance loss, and the Docker authors in the docks recommend native software for Hyper-V
  2. Replace provider in old projects. Vagrant (according to the docs) supports Hyper-V

I tried to go the second way - it did not work out with a swoop. Because the image I'm using (bento/ubuntu-16.04) doesn't support Hyper-V. So the image needs to be replaced. And at this moment I decided - I will ask for advice from those who have already passed this path. I don't want to run into bugs.
Questions :
  1. If you worked with Vagrant + Hyper-V, and especially if you switched from Virtualbox, are there / were there any problems? I mean, if I write another box instead of bento / ubuntu, won't I open a pandora's box with some specific errors / problems that only appear with Hyper-V?
  2. Anything I didn't take into account? A thousand thanks for any advice.
Update : what exactly did you try. Replaced box and provider in Vagrant. Boxes kmm/ubuntu-xenial64, maxx/ubuntu16, generic/ubuntu1604. With the second the machine starts up, I can even ssh into it. But on startup the error is "No host IP was given to the Vagrant core NFS helper. This is an internal error that should be reported as a bug."
With other boxes it crashes with different errors before. Updated Vagrant to 2.0, still didn't help. Long story short, I've already wasted half a day and haven't made any headway. Therefore, I ask for advice.
Update 23.10 : Tried docker-machine. This is a utility that creates a virtual machine in Virtualbox, installs the Docker Engine there, and, as it were, "proxy" requests from the host machine there. Simple examples started right away, but there was a nuance when trying to use volumes in a container.
The thing is, if you want to use volumes in your project (and you most likely do), you either need to
  1. Store project(s) in C:\Users because this directory is automatically mounted in docker-machine
  2. Or, when starting docker-machine, automatically mount your directory (in my case, D:\Projects)

For those interested, the details are here https://stackoverflow.com/questions/30040708/how-t... (in principle, this is not very difficult, but still counter-intuitive). In general, volumes worked for me on a simple example, although I spent another half a day on it.
I will tune further tomorrow, the day after tomorrow and so on until it works. Well, or until you get bored. I thought, if the result is success, then maybe it’s worth making a post on Habré?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Grigory Tumakov, 2017-11-20
@VokaMut

About directory D:\Projects
Open Virtualbox and mount disk D in your virtual machine:
Name|Disk|Auto connection|Access
d/ | D: | Yes |Full

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question