Magento – How to setup development environment for magento 2 with docker

dockerinstallationmagento2

I am trying to install Magento 2 on my macOS Mojave

I have installed Docker first.
Then,
I followed this https://github.com/clean-docker/Magento2 link but stuck at last here is the error that comes in terminal (last part):

...........
...........
358ea099d7a6: Pull complete 
03ce86db77da: Pull complete 
Digest: 
sha256:289226e3474f6d306c93c14bd13291e6bd239182660efa593e6ed79e96fdf647
Status: Downloaded newer image for rafaelcgstz/magento2:latest
fatal: not a git repository (or any of the parent directories): .git
sed: docker-compose.yml: No such file or directory
bash: line 31: src/index.php: No such file or directory
chmod: src: No such file or directory
bash: start: No such file or directory

Any help will be highly appreciated!

Best Answer

Here is how I am running successfully:

Step 1. Install Docker

https://docs.docker.com/docker-for-mac/install/

Step 2. Clone Docker Image for Magento 2

https://github.com/rhinos-dubai/docker-magento2

or

https://github.com/markshust/docker-magento

or

https://github.com/clean-docker/Magento2 or you can use any other reliable Image.

Step 3. I am considering 1st link for image here. Now from terminal go to the folder YourlocalFolderName/docker-magento2 like

cd YourlocalFolderName/docker-magento2

and run:

docker-compose up -d

Now go to your web container by this command:

docker exec -u 0 -it docker-magento2_web_1 /bin/bash

or

bin/shell

Step 4. Now run:

install-magento

Now type same url in your browser as in env file. Thats it.

If you want to install sample data just run:

install-sampledata

Push vote up if it was useful for you, so that it may ease the coming readers.

Related Topic