Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve/update Windows docker compose setup #100

Open
birdman002 opened this issue Aug 23, 2018 · 57 comments
Open

Improve/update Windows docker compose setup #100

birdman002 opened this issue Aug 23, 2018 · 57 comments

Comments

@birdman002
Copy link

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

@markshust
Copy link
Owner

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.

@birdman002
Copy link
Author

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

@markshust
Copy link
Owner

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

@birdman002
Copy link
Author

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.

@itsazzad
Copy link

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

@markshust
Copy link
Owner

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 markshust reopened this Oct 31, 2018
@zsoerenm
Copy link
Contributor

Yes in commit 7bdd466#diff-9b7421fc1fe30ba6845586284d35a9fe source was falsely renamed to src
Going to make a pull request.

@zsoerenm
Copy link
Contributor

zsoerenm commented Oct 31, 2018

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 #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: 8af87f9#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.

@markshust
Copy link
Owner

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 markshust reopened this Nov 27, 2018
@markshust markshust changed the title cp: cannot stat '/src/.': No such file or directory Improve/update Windows docker compose setup Nov 27, 2018
@markshust markshust pinned this issue Jan 28, 2019
@markshust
Copy link
Owner

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

@zsoerenm
Copy link
Contributor

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.

@markshust
Copy link
Owner

@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.

@alainseys
Copy link

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 ?

@markojak
Copy link

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? ;)

@markshust
Copy link
Owner

@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.

@zsoerenm
Copy link
Contributor

zsoerenm commented Oct 28, 2019

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.

@markojak
Copy link

@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?

@markshust
Copy link
Owner

@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
Copy link
Owner

@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.

@df2k2
Copy link

df2k2 commented Oct 29, 2019

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.

@alainseys
Copy link

you can test docker by docker-pull hello-world and docker run hello-world.

dont forget to install docker-compose

@alainseys
Copy link

Oh forgot to mention to to reload the bash file you need to run source ~/.bash_profile and source ~/.bashrc

@sunilit42
Copy link

~/.bashrc
/home/*/.bashrc: line 8: return: can only `return' from a function or sourced script

@sunilit42
Copy link

Above issue fixed but
docker info
Cannot connect to the Docker daemon at tcp://localhost:2375. Is the docker daemon running?

@alainseys
Copy link

Above issue fixed but
docker info
Cannot connect to the Docker daemon at tcp://localhost:2375. Is the docker daemon running?

You have docker installed on your windows?
Is the port exposed?
Try connecting with vscode to wsl.
You can also try and add tcp://0.0.0.0:2375 as well.

The docker status will keep reporting as not running since wsl canot check the status of a windows service.

You çan test if docker is working by docker-composé up or run hello-world.

@sunilit42
Copy link

Hello,

i am working on window home edition so docker into window does not work

does possible to direct install into window ubnuntu and check it same like directly we do into linux

@alainseys
Copy link

Hello,

i am working on window home edition so docker into window does not work

does possible to direct install into window ubnuntu and check it same like directly we do into linux

Indeed hyper v does not work on home edition only on pro.

You çan indeed install virtual box and play with docker on vbox.

Or you can install Linux native

@alainseys
Copy link

i will give wsl 2 a try i will post the end result

@alainseys
Copy link

i have upgraded wsl to v 2 and the image builds as expected.

https://docs.microsoft.com/en-us/windows/wsl/wsl2-install

@sunilit42
Copy link

sunilit42 commented Dec 26, 2019

Is that possible without docker in window?

@alainseys
Copy link

Is that possible without docker in window?

you can install docker without windows on linux or mac, if you want docker with integration on WSL you need to have docker on the host machine and inside the wsl instance

@sunilit42
Copy link

is not possible just install docker into WSL and somehow allow tcp with the port with window machine without docker into the window.

@markshust
Copy link
Owner

FYI support for Windows-specific helper scripts has been dropped b23f44e

I'll keep this ticket open until Windows installation on WSL is documented.

@alainseys
Copy link

alainseys commented Dec 30, 2019

The steps that need to be followed are.

  • enable virtualisation platform
  • enable wsl
  • enable developer mode in windows updates
  • signup for windows insider
  • update until you got the latest version(fast repo)
  • download /install docker (apt-get install docker.io - y)
  • download /install docker-compose
  • expose docker daemon
  • enable experimental wsl feature
  • download Ubuntu in Ms store
  • activate Ubuntu on wsl expimental.
  • update bash rc and profile ( source ~/.bashrc)

export DOCKER_HOST=localhost:2375 echo "export DOCKER_HOST=localhost:2375" >> ~/.bash_profile

echo "export DOCKER_HOST='tcp:0.0.0.0:2375'" ~/.bashrc

After this you should be able to run docker notice wsl can't give you the status of the docker service to check for errors run docker - - version if this does not result in a error your Docker instance is working.

And follow the Linux steps in this repo.

@pparga
Copy link

pparga commented Jan 2, 2020

Hi @markshust ! Thanks for the nice repository that you have built! As you said creating the environment on wsl2 was pretty straight forward (same as linux), but I need some help connecting to the server via browser.

The problem seems to be from the wsl2 where, even though i added the entry on both host files (wsl2 and windows), i am unable to connect to it as the hosts seem to not be communicating. I have had these problems before with docker and wsl2, and the only workaround that actually worked for me is just accessing it via localhost and the port exposed in php for example. I couldn't do this now and i was wondering if you have any idea, suggestion, workaround that could help me.

Thanks again!

@sunilit42
Copy link

Getting below error
https://www.screencast.com/t/8fFjXw5Urqv

@LiamKarlMitchell
Copy link

LiamKarlMitchell commented Feb 4, 2020

Using WSL 2 with Ubuntu stuck at Extracting magento2-2.3.0.tar.gz to ./src
Or maybe this just takes a very long time..., have you made published images that are ready to go?

This may help to speed up composer install.

composer global require hirak/prestissimo

@willboudle
Copy link

Does anyone have any good tutorials for getting M2 up and running on WSL 2?
Eager to start this course and basically been unable to get a worth windows install for... ever.

@LiamKarlMitchell
Copy link

I haven't attempted it again yet, but have done some other projects that are not Magento 2.
One note I have is if volume mapping the source folder don't do it from Windows the IO speed is still far too slow and it does not have inotify events.

Instead you can goto this in explorer can map it as a network drive and edit within it.
\\wsl$\Ubuntu\root

Should only really have a volume for the app and a few other folders for persistence (media/static?)
Vendor and lib folders can just be copied to the container.

When you open a Ubuntu terminal you can then do the docker-compose up and still have mounted volumes.

Maybe have the DB server just running on the host.

@markshust
Copy link
Owner

A lot has changed with Windows, WSL2, and Docker since I last tried this process (for the better).

I started a discussion at #372 and I'm at the last step to get SSL working. I should have working documentation soon 😄

@markshust
Copy link
Owner

Has anyone subscribed to this ticket figured out SSL, in regards to getting it working with WSL2/Ubuntu 20?

@df2k2
Copy link

df2k2 commented Jan 25, 2021

If you are using Firefox and it warns you the SSL certificate is invalid/untrusted, go to Preferences -> Privacy & Security -> View Certificates (bottom of page) -> Authorities -> Import and select ca.cert.pem for import, then reload the page.

If you are using Chrome on Linux and it warns you the SSL certificate is invalid/untrusted, go to Chrome Settings -> Privacy And Security -> Manage Certificates (see more) -> Authorities -> Import and select ca.cert.pem for import, then reload the page.

@markshust
Copy link
Owner

Thanks @df2k2. I'd like to find an automated solution also if possible?

@markshust
Copy link
Owner

Thanks @df2k2, I'll use this for the initial documentation.

And I have great news! I have confirmed the instructions at #372 are indeed working, and have replicated on install of Magento 2 on Windows using WSL 2 and Ubuntu. I'll be writing up some formal documentation so we can finnnnnnally close out this ticket.

Performance is great.

@CosyStudios
Copy link

If you are using Firefox and it warns you the SSL certificate is invalid/untrusted, go to Preferences -> Privacy & Security -> View Certificates (bottom of page) -> Authorities -> Import and select ca.cert.pem for import, then reload the page.

If you are using Chrome on Linux and it warns you the SSL certificate is invalid/untrusted, go to Chrome Settings -> Privacy And Security -> Manage Certificates (see more) -> Authorities -> Import and select ca.cert.pem for import, then reload the page.

Where abouts do I get hold of ca.cert.pem ?

Installing this on WSL2 has been a real headbanger so far but im nearly there !
installation got stuck on copyfromcontainer but i just skipped it in the end (3 hours?) and seems to be ok.

@alexdkaminski
Copy link

Thanks @df2k2, I'll use this for the initial documentation.

And I have great news! I have confirmed the instructions at #372 are indeed working, and have replicated on install of Magento 2 on Windows using WSL 2 and Ubuntu. I'll be writing up some formal documentation so we can finnnnnnally close out this ticket.

Performance is great.

@markshust Mark have you had a chance to write up this documentation yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests