A
A
ADA M2019-03-01 23:41:22
Windows
ADA M, 2019-03-01 23:41:22

Development on Windows 10 on Linux with Docker?

I prefer Windows to Linux for many reasons (MS Office, Adobe, games, user-friendly interface, etc.). I used to try WSL, in principle, quite a working method, though there were a couple of drawbacks: slow I / O (about 3 times), problems with line wrapping (/r/n - solved by git'a configuration on Windows), well, maybe there would be problems with the rights to files, but did not face it.
I am currently working on Ubuntu. I come across different projects (PHP Symfony) where different environments are needed. As a result, I started looking towards Docker. And immediately pulled back to Windows.
Please tell me, experienced developers, is this a good idea?) As I understand it, Docker positions itself as a cross-platform solution, so this is quite possible?
I searched for a long time on the Internet for a guide on how to set up LEMP + Symfony 4 and PHPStrom, and did not find a detailed explanation. A lot of questions came up:

  • Now I have no idea how the project sources should be rummaged (docker documentation for windows says that it is not recommended to keep shared folders on the host machine: "If possible, avoid volume mounts from the Windows host, and instead mount on the Linux VM, or use a data volume (named volume) or data container."). Then where to store the sources, configs and database data?
  • Do you need to execute Symfony, git, composer console commands in docker containers? If so, how to set it up in PHPStorm? Do I understand correctly that on the host machine where docker is installed, there should be nothing but docker in fact (well, except for the IDE, etc.)?
  • Well, and probably the main thing: if I edit the sources with Windows PHPStorm, what will happen to my files (line breaks, folder permissions, etc.). If you have tried this, what problems did you encounter and how to avoid them?

Sorry for the long text, it seems to me that the topic is interesting for many) Still, you won’t refuse Windows one way or another)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
VoidVolker, 2019-03-02
@VoidVolker

Just install VirtualBox for yourself . You do the basic setup of the desired version of the desired OS once. Next, make the required number of OS clones in one click for the desired working environment options. And then use the desired OS. As the virtual machine breaks, you make a new clone with a clean OS.

G
grinat, 2019-03-02
@grinat

There will be no problems in development under php only.
Under php date volumes should only be used for the database, because if you mount the database in a folder under Windows, then for example postgre will not even start, or if specific rights are needed.
There is docker support in the storm, but everything is very inconvenient and strange there, it is better to use a porter, everything is simple, convenient and visual there. Git commands on the host, run the rest in the container.
With the rights of the problem, if the folder is mounted and the necessary special rights, since they cannot be changed. With transfers, yes, in the source code it is not relevant, but Bash scripts and various env can cause problems, but this is easily solved if you get into the ide settings.
There are more serious problems in Windows, for example, there is no support for fs.notify, that is, hot reload in go / js / any other language will not work. Docker requires hyper-v to be enabled, the android studio emulator requires it to be turned off (and this requires a reboot), that is, under Windows, it is not possible to adequately expand the backing in docker and watch the result in the simulator, there is a real solution in the face of a lame simulator from microsoftware. Hemorrhoids with resources, if there is some kind of well-eating container, you can set up its work. Different specific images from the docker hub will also not work or they will give strange errors.
Regarding the refusal of Windows, the last time I launched Windows was a year and a half ago. Popular games work fine under Linux too, if the game is available for Mac, it will be under Linux with a 90% probability. If you need Windows so much, that is, Vine or you can raise the virtual machine.

Y
yayashitoya, 2019-03-02
@yayashitoya

This is more like Vagrant than Docker (and even faster than WSL, despite the fact that Vagrant uses a full-fledged virtual machine, unlike WSL).
It is Vagrant that is designed to quickly raise the development environment. Similar to Docker in some ways (for example, Vagrantfile is also configured through one single file, almost a Dockerfile; you can also specify all the necessary software in the configuration file).
If you search https://app.vagrantup.com/boxes/search, you will surely find it with a ready-made LEMP stack. PHPStorm, of course, should be under the native GUI, and not inside the virtual machine.
Yes, Windows/MacOS is head and shoulders above Linux in terms of GUI convenience, don't you think.
Even working on Ubuntu, it made sense to create a completely isolated environment for launching / debugging, in order to avoid subtle glitches when moving the project to the server (due to the non-identity of the environment, primarily libraries; due to the difference in versions - and for PHP there are just similar problems often occur).
So it makes sense to use Docker/Vagrant, no matter where you are working on Windows/MacOS/Linux.
However, specifically Docker seems inconvenient. You want to screw it for tasks for which it was not originally intended. The concept of Docker means that the software is stable and resides in a container. Only the data that is connected via volume changes. Of course you can screw it up, but...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question