How to setup Docker Image for Magento 2 on Mac Book?

The question:

I want to setup Docker for Magento 2.

I have gone through number of links but didn’t find the solution yet. Can somebody share useful links to do this.

Thanks

The Solutions:

Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.

Method 1

Here is how I figured it out:

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.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Comment