docker-magento icon indicating copy to clipboard operation
docker-magento copied to clipboard

Improve/update Windows docker compose setup

Open birdman002 opened this issue 7 years ago • 57 comments

I am on windows, I am working on going through this repo to install magento.

I get to the bin/copymagento, after it does all the pulls i get this error

cp: cannot stat '/src/.': No such file or directory

Not sure where I went wrong.

Thank you!

Best

birdman002 avatar Aug 23 '18 17:08 birdman002

sorry, i have windows versions but don't really support windows. you might want to ask your questino on stackoverflow.com.

my only guess is you are missing a directory named src.

markshust avatar Aug 23 '18 17:08 markshust

I went through the steps, so just so i understand is that bin/copymagento is taking the magento source and copying it to the container? So would the src be missing on my computer or on the container?

Thanks for your help I appreciate you getting back to me

birdman002 avatar Aug 23 '18 17:08 birdman002

sounds like it would be missing on the host (your computer). so you probably need to unzip magento to your local src folder.

markshust avatar Aug 23 '18 18:08 markshust

I unzipped it to my src folder.
docker-compose run -d --user=root --no-deps --rm -v $PWD/src/.:/source phpfpm cp -r /src/. /var/www/html

My error seems to be on the /src/ after the cp -r i believe. Should there also be the $PWD before as it is after the -v ? When i exec into the nginx container the app and bin folder are in the html folder. Should everything that is in the src folder on my host computer be in the html folder on the virtual box?

Thanks again, I appreciate it.

birdman002 avatar Aug 23 '18 19:08 birdman002

I am also facing the same issue: With PowerShell: cp: cannot stat '/src/.': No such file or directory With Git Bash: cp: cannot stat 'C:/Program Files/Git/src/': No such file or directory

itsazzad avatar Oct 31 '18 13:10 itsazzad

I'm reopening this ticket (I actually don't know why I closed it in the first place). the windows configuration needs some updates, there have been a lot of updates to this repo and windows really wasn't factored in.

@zsoerenm did the initial windows config. not sure if you can help at all? šŸ˜‹

markshust avatar Oct 31 '18 14:10 markshust

Yes in commit https://github.com/markoshust/docker-magento/commit/7bdd466f55b8573c336e40f2a30dc4ec8bcca1df#diff-9b7421fc1fe30ba6845586284d35a9fe source was falsely renamed to src Going to make a pull request.

zsoerenm avatar Oct 31 '18 15:10 zsoerenm

I wonder if the windows version is still functional. I had to copy the whole magento folder into the container because of permission problems when mounting the whole folder into the container. Instead I mounted only those folders into the container where the actual development happened (see https://github.com/markoshust/docker-magento/pull/83) so that the correct permissions could be set for the public folders. Unfortunately it was eventually reverted and now the whole folder gets mounted into the container: https://github.com/markoshust/docker-magento/commit/8af87f92eb68a11f82cc362061b397e2227d5a89#diff-4c1ddac5aca0fc7e08d5acd5c45a3c6b EDIT: It looks like Docker has changed the permission from 0755 to 0777 for shared volumes (see https://docs.docker.com/docker-for-windows/troubleshoot/#volumes). That means there is no need for Magento to be copied into the the container anymore. bin/copymagento can be removed and the current docker-compose.yml file is fine.

zsoerenm avatar Oct 31 '18 16:10 zsoerenm

I merged this PR but this issue shouldn't have been closed.

Thank you @zsoerenm for the PR. The windows version definitely needs some work, so going to keep this ticket open to work on the windows docker compose setup. I don't have a Windows machine to test on, but would love to take a PR to fix it up so we can fully support it again.

markshust avatar Nov 27 '18 17:11 markshust

i pinned this post on github to try to get it more attention.

markshust avatar Jan 28 '19 15:01 markshust

I am sorry that I did not have a look into this. In the mean time I started my own docker environment, since I wasn't happy with the multiple bash files, performance, etc. (BTW: I guess the performance of this environment got a lot better now) I also wanted to use docker in the production environment and to implement the recommended deployment strategy from Magento. Here you go: https://github.com/zsoerenm/magento2-docker There is still some documentation missing and I have to finalize the procedure going from development to production.

zsoerenm avatar Jan 28 '19 16:01 zsoerenm

@zsoerenm cool, by the looks of it we came to the same resolution for performance :) yes very performant now.

i'm not super fond of how i implemented the bin helper scripts either, however i found it to be the best interim solution until we can figure out a better way so user's wouldn't need to understand all of the docker commands. i'll check out your repo for inspiration if i can for backporting windows support again. i also made a few steps towards making it compatible with unified dev/prod environments, needs a bit more work though. awesome job, i think we can all learn from each other.

markshust avatar Jan 28 '19 18:01 markshust

I am on windows, I am working on going through this repo to install magento. I get to the bin/copymagento, after it does all the pulls i get this error cp: cannot stat '/src/.': No such file or directory Not sure where I went wrong. Thank you! Best

did you create a enviroment variable for 7z ?

alainseys avatar Sep 27 '19 07:09 alainseys

Hey @markshust, this is such an awesome repo and just missing Windows support (We have a few developers using Windows) and @zsoerenm seems to have done some great work here. Instead of us having so many forks of magento2-docker why don't you guys work together and make beautiful babies? ;)

markojak avatar Oct 27 '19 20:10 markojak

@markojak really really appreciate your donation šŸ‘ totally awesome

i would love to collab with @zsoerenm and try to get windows support back in here. i haven't taken a look at this issue in a while since the demand quite hasn't been there, and i'm working on some educational material right now that i believe is more important. that said, i would love a PR to get all of the scripts working for windows. fyi it was working at one time, the scripts are still up at https://github.com/markshust/docker-magento/tree/master/compose/magento-2-windows/bin -- i know @df2k2 is also a huge powershell guy so maybe he can chime in šŸ˜‰

i'm so far disconnected from windows, i don't think i would be of much help here and i really don't want to go down that rabbit hole again unfortunately. but would love the current bin helper scripts at https://github.com/markshust/docker-magento/tree/master/compose/magento-2/bin backported to powershell. once they are fully backported i can most likely maintain all of it.

markshust avatar Oct 28 '19 13:10 markshust

I took a different approach: Shell scripts often depend on the operating system. That's why I reduced the number of scripts down to zero. IMHO, to get Magento up and running should be as easy as docker-compose up. This is even more pronounced if you use Docker for development and production. Nevertheless, @markshust has done a great job. I took some inspiration from here and the update rate is good. My repo needs some love. I won't have time to update it until next year.

zsoerenm avatar Oct 28 '19 16:10 zsoerenm

@markshust - I've shared this repo with my colleagues as well and encouraged them to sponsor as well. I think for me the biggest challenge now isn't windows but rather the slow compile times. This is a function of the native filesharing volumes for MacOS + Docker - It seems that the only fix for this is docker-sync or something equivalent.

How do either of you deal with the slow speeds?

markojak avatar Oct 28 '19 16:10 markojak

@markojak have you tried out this setup on a mac?

i blogged about docker performance for mac at https://markshust.com/2018/12/30/docker-mac-filesystem-volume-mount-approach-performance/ -- mainly comes down to using delegated volumes, and not syncing over entire folder structures. magento filesystem is the biggest baddest beast out there in php land, and pretty sure i hit every issue so far with it. that said, i use this setup daily and develop on it, and don't have any performance issues at all. docker-sync and the like are dead/deprecated in my head with the release of delegated volumes... i think the last time i used that was 3 years ago šŸ˜„

markshust avatar Oct 28 '19 16:10 markshust

@zsoerenm i don't plan on getting rid of the helper scripts anytime soon, if anything i'll abstract them out even more. newbs don't know docker, nor should they need to know it. i'm trying to take more of a simpleton approach of abstracting docker away to the background. at the end of the day i don't want users to even know they are using docker.

markshust avatar Oct 28 '19 16:10 markshust

thanks for the call out @markshust. I’d be happy to get involved here to see what o can do help. I have had a few ideas lately.

df2k2 avatar Oct 29 '19 00:10 df2k2

I checked out the blog post and I'm using your docker-dev.yml file as you've recommended in your course (great course by the way and thanks!)

Extract from my docker-dev file.

services:
  app:
    volumes:
      &appvolumes # Host mounts with performance penalty, only put what is necessary here
      - ./src/public/app/code:/var/www/html/app/code:delegated
      - ./src/public/app/design:/var/www/html/app/design:delegated
      - ./src/public/app/etc:/var/www/html/app/etc:delegated
      - ./src/public/composer.json:/var/www/html/composer.json:delegated
      - ./src/public/composer.lock:/var/www/html/composer.lock:delegated
      - ./src/public/nginx.conf:/var/www/html/nginx.conf:delegated
      #- ./src/var/log:/var/www/html/var/log:delegated
      #- ./src/var/report:/var/www/html/var/report:delegated

markojak avatar Oct 29 '19 13:10 markojak

From my side I really like the helper scripts. I am quite familiar with docker commands but I also really like the bin scripts -- I have combined this with my own scripts to quickly run compile commands using things like mage2run

markojak avatar Oct 29 '19 13:10 markojak

any update for widnow ?

sunilit42 avatar Dec 05 '19 19:12 sunilit42

This is a final call for anyone wanting to contribute to Windows support for this repo. I have no desire to support Windows myself as I have no experience with it and don't see a real high demand for it. I'll be closing this ticket if someone doesn't want to take this by Dec 31, and will take Windows off the possible supported list of o/s's to support.

markshust avatar Dec 21 '19 14:12 markshust

I'll be dropping the Windows-specific support because I've been told it works with WSL out of the box with no reported issues. The Windows-specific helper scripts take a ton of work to maintain, and it doesn't look like the demand is there especially with the improvement of WSL.

I'm going to test out WSL myself to ensure it works, and update the README to include any "gotcha" info to get things to work on Windows with WSL.

markshust avatar Dec 24 '19 14:12 markshust

Hello,

I try with winwow with WSL but when i run below command nothing happen curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/onelinesetup | bash -s -- magento2.test 2.3.3

sunilit42 avatar Dec 25 '19 05:12 sunilit42

Hello,

I try with winwow with WSL but when i run below command nothing happen curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/onelinesetup | bash -s -- magento2.test 2.3.3

you do not have docker / docker-compose installed on wsl

alainseys avatar Dec 25 '19 12:12 alainseys

Hello,

I try with winwow with WSL but when i run below command nothing happen curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/onelinesetup | bash -s -- magento2.test 2.3.3

Bellow are the steps to get this working on WSL

sudo apt-get update -y sudo apt install docker.io

sudo /etc/init.d/docker start (no systemd) sudo apt-get install curl -y sudo curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose

curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/onelinesetup | bash -s -- magento2.test 2.3.2

alainseys avatar Dec 25 '19 12:12 alainseys

Don't forget to expose your Docker daemon and ad it to the bash rc file you can check if docker is running correctly by executing Docker - - version if it shows up no errors than you are good to go.

alainseys avatar Dec 25 '19 13:12 alainseys

getting below error:- ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.

sunilit42 avatar Dec 26 '19 06:12 sunilit42