A
A
Artem Soshnikov2016-05-30 21:53:41
symfony
Artem Soshnikov, 2016-05-30 21:53:41

How do you use docker for development on Windows?

At the moment I'm using docker through virualbox with disabled folder sharing.
Now, to upload changes to the container, I use a script that essentially does:
- docker-compose up
- docker cp
- docker exec ... chown
The last two commands take 15-40 seconds.
Perhaps there are other more correct ways to deploy code to a container?
PS I do not use Shared folders. with them, a pure symfony application runs in 2-6 seconds.

Answer the question

In order to leave comments, you need to log in

6 answer(s)
A
Artem Soshnikov, 2016-06-01
@artem90

So, I found not the most elegant solution, but quite working:
ed. It turns out not quite working.
After restarting the virtual machine, it is necessary to unload all the project files again, while fixing the access rights to /c/Users in advance.
I leave it here for now, maybe someone will have ideas
1. Disable shared folders in the virtual machine settings.
2. Enable sftp for the virtual machine:

# Открываем машину в virtualbox и редактирем конфиг ssh сервера
vi /usr/local/etc/ssh/sshd_config
# и добавить строку
Subsytem sftp internal-sftp
# для тех, кто не работал в vi
# сначала жмем i
# затем добавляем нужную строку 
# жмем ESC, жмем :
# вводим (внизу слева) wq жмем enter

3. We restart the virtual machine so that the shared folders are no longer available and the ssh server is restarted (I did not find how to restart it like service sshd restart)
4. Create the desired path:
mkdir -p /c/Users
chown 0777 /c/Users -R

5. Generate a ppk key to connect.
It is necessary to pass the %userprofile%\.docker\machine\machines\default\id_rsa key to the puttygen program.
6. We configure the connection in the storm to the virtual machine via sftp, specifying the ppk file generated in step 5. docker username. At the same time, we indicate that the files should be loaded automatically.
7. Set up file mapping. Please note that the local path and deployment path must match
8. We indicate that we want to change the rights on the downloaded files and folders to 0777 automatically when downloading.
That's all.
Now you can make changes to the project, which will be automatically uploaded to the docker virtual machine via sftp.
At the same time, Docker spins quite quickly - the symfony dev environment loads in 60-150 ms.
We no longer need to go into the virtual machine itself, everything will also work through the docker console.

I
index0h, 2016-05-31
@index0h

you can mount a directory between the docker and the virtual machine, there should not be any serious performance loss. At the expense of shared directories - it really should be disabled.

J
jaxel, 2016-05-31
@jaxel

No way. What I didn’t try to do, it’s impossible to work normally with a virtual machine with symphony under Windows. I spat, and put Debian to work.

A
Anatoly, 2016-05-30
@taliban

Why are you using Disabled Sharding? It’s more convenient to turn on the shared folder and you don’t have to upload the code anywhere.

D
de1m, 2016-06-01
@de1m

This is a longstanding problem in virtualbox. When a folder is accessed, it freezes. I have been observing this garbage since the third version, although it used to be much more pronounced.
I don’t know how you create a virtual machine, I use “vagrant” for this, you can use rsync instead of sharedfolder ( here ), but I don’t know if it does synchronization only at startup or every time the contents of the folder change.
You can also stupidly mount the ball from Windows to the virtual machine through "cifs"

V
Vaavaan, 2016-06-03
@Vaavaan

For development, especially on Windows, you need not Docker, but Vagrant.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question