You're a genius! I found a lot of Docker images, tutorials, and stuff, but after three days of struggling, I'm amazed at how easy it was with your script! It simply worked!
It’s definitely helped my setup time. I had my own docker setup but using it with multiple different project always required a bunch of tweaking. But your set up has made it 1000% easier
Hi Mark thanks for the amazing amount of effort that you put into this project. One question would be could this be used to run Magento2 on a VPS server live? If yes what changes need to be made to make it run securely? If not what steps must I take to get Magento2 running as quick, easily, and securely as possible?
Hi there - thanks for the kind words! This environment is meant for development, so some updates would need to be made for prod, including customizing the images and such. I don’t have a formal process for this and generally leave it up to each use-case to implement at the moment, though I am thinking through deployment options.
Great script! Do you also have a tutorial, how to move from a huge old classical Magento (2.3.7) installation to a nice state of the art docker magento environment?
Hi Matthias! I'm sorry that I do not -- 2.3.7 is ancient! I'd recommend getting Magento up to speed on the first version that supports both PHP 7.3 and 8.1, which I believe is 2.4.3. Once at that point, it shouldn't be much of a reach to get things set up on docker-magento. Some old tags also support 2.3.x, but you'll need to search for those through the documentation/commits as it's been a while. I'd recommend not falling behind Magento more than 2 versions at any given time. -Mark
Hey Duke, these keys have always been required for as long as I can remember. Info on how to set these keys up is at courses.m.academy/courses/487758/lectures/8974570
Hi mark, i am facing this issue in my container logs, [Error] APM: Locking APM for 300 seconds for reason: Cannot connect to the agent" can you please guide?
Hi Hallar, I'm sorry I have not had this issue, but it was reported in the past. Please see github.com/markshust/docker-magento/issues/700 and follow up with any additional info that would help us resolve this unique error. Thanks! -M
Hi, I have a question, Im trying to have a very energy efficient server. and trying to move to an ARM64 Cluster, Is it possible to install magento safely or not yet?
Hey Bruno -- yes, this should be no problem at all. My Docker images are built for dual-compatibility for both Intel and Mac ARM chips, and Magento runs completely fine without any issues. -Mark
This project uses mkcert, so it doesn’t depend upon third-party services. You could integrate Let’s Encrypt though by using their provided instructions with Docker + Nginx.
Hello sir, when I use your steps to install Magento 2, I often encounter this error. What is the problem? chmod: cannot access 'bin/magento': No such file or directory
It appears as though your install failed for some reason. I’d recommend blowing it away and trying again, noting any errors that may be thrown in the terminal during the install process. Info of how to do this and this error is in the GitHub readme.
I followed the manual steps and it stopped at container started and the logs in the container shows Closed keepalive connection. Not sure what I did wrong, but maaaan Magento is difficult to get started with
It’s hard to tell what’s going on without seeing it, but bin/status should show all containers in an active state. If not, please open up a new Discussion on GitHub so you can try to get this resolved. There are usually no problems running this out of the box.
Thank you, Mark, for the simplicity of installing Magento. You're a boss !! However, I have a seemingly simple issue. On the admin page, I don't know which username and password to use. I am a complete amateur with Magento and have been struggling for hours. Thank you for your response.
Thanks 😊 The admin creds are in the env/magento.env file. Note that I have a full course available on this and many more things at m.academy/courses/set-up-magento-2-development-environment-docker/. You can also install my DisableTwoFactorAuth module on GitHub at github.com/markshust/magento2-module-disabletwofactorauth which automatically disables 2FA when developer mode is activated.
@@MarkShust Thank you, Mark, for your quick response! I entered the credentials from the db.env file, but I think they correspond to MySQL. However, I inserted the credentials from the magento.env file (your credentials). It asks for two-factor authentication 😭. Thank you for the link, I will check it out!
@@mattew862 ah sorry about that! I meant to say to use the env/magento.env file. 2FA is required for Magento and you'd need to set that up... or use my trusty DisableTwoFactorAuth module that I made just for this reason! It auto-disables 2FA when developer mode is enabled. You can get it on GitHub at github.com/markshust/magento2-module-disabletwofactorauth
@@MarkShust I used your link. It installed correctly. The problem persists. I went through all the steps. Everything works. But I still can't log in to the dashboard. I changed the username, password. Same result. I'm close to giving up. Thank you for your advice. I wouldn't want to clutter the comment space.
@@mattew862 I have a feeling that you are not prefacing your composer command with "bin/". So rather than typing "composer", type "bin/composer". This ensures that composer executes within the docker container and installs the code in the correct location. If you instead run Composer locally, it will only install in a local directory. See my course -- it fully covers this and much more! I've installed Magento hundreds of times on new computers, and it works every time.
I get this error when running the curl command: Error response from daemon: Ports are not available: exposing port TCP 0.0.0.0:80 -> 0.0.0.0:0: listen tcp 0.0.0.0:80: bind: address already in use
Hi Ravi -- sounds like you have another service running locally (either Apache, Nginx, MAMP, etc.), so you'll need to stop that service in order to run docker-magento due to the way host-bind mounts work with Docker.
Hi Mark Shut, i tried this way many times, but it always show me this error :chmod: cannot access 'bin/magento': No such file or directory , Pls help.Tks
Magento has a headless eCommerce architecture right? How easy is it to connect a customized frontend to the backend? Do you have videos for building frontends? I am not so fit with the backend and I would like to know if a webshop with magento is relatively easy to realize in your opinion :)
Magento is anything but easy. It's a commitment, because it is very powerful, but with that power comes great responsibility. It comes with a full GraphQL implementation in which you can build a completely custom frontend if you wish, but you'd need to have fairly extensive experience to go down this route. I typically recommend everyone to use Hyvä, but if you are using the built-in theming setup (Luma), I'd very much recommend taking my course on theming at m.academy/courses/magento-2-power-theming/. As far as headless frontends, there are platforms out there such as Vue Storefront which makes this approach less of a reach (still very involved though).
@@MarkShust Thank you very much for the detailed answer. I am just in my last year of my computer science studies and wanted to deepen my knowledge in ecommerce and therefore create my own web store. As soon as I have the financial means I will definitely look into your course, thanks again!!!
Thank you, but when i tried to login to admin dashboard using provided credentials in the env it says "The account sign-in was incorrect or your account is disabled temporarily. Please wait and try again later.". what did i miss ?
Hi there, it sounds like your account was locked out from too many failed login attempts. It's a security measure put in place by Magento that prevents brute-force login attempts. Luckily, you can easily unlock this from command line with: bin/magento admin:user:unlock john.smith
Mr Shust - Many thank yous for creating the Docker-Magento solution! Which host do you recommend for deploying Magento as a Docker container? I tried Heroku, but I'm struggling to get the 8 images to run without crashing. My guess is I need to include the prefixes in the images names/tags (eg linuxserver/phpmyadmin as opposed to phpmyadmin). But Heroku's "release" command doesn't seem to like those forward slashes. Any ideas?
Thanks! I generally recommend a managed hosting solution at this time, as simply figuring out how to deploy Magento is super time consuming (I’d rather stick with writing code). It is a problem that I’m thinking about. That said, I’d recommend looking up Damien’s Kubernetes setups to learn how to run a proper containerization setup for Magento.
@@MarkShust Thanks for the response Mark! Do you know of anyone who has successfully deployed your Docker-Magento solution to a host? It is working fine on my machine. But I want to deploy it to a host and make it publicly available as an actual store for my daughter.
Mark Thank you. I was able to install successfully! I've changed something in file, cleared cache but nothing changed in frontend. What did I miss? Do I need any docker command?
Hi Asad, glad it installed successfully for you! It’s possible you are trying to modify a file or folder that is not set up to be bidirectionally synced. Only files or folders listed in the compose.dev.yaml file are synced.
Hi Mark. Here I am again with another question. My friend has an Abode Enterprise and he setup his local successfully. Then he zip his vendor folder and send me. Can I replace that with my vendor. Do I need to run any commands to make it works. I only use this for my local dev. Thank you very much
Hi Ethan, this is the entirely wrong workflow to use with Composer. There is no need to copy & paste the vendor folder around -- simply run "bin/composer install" from the command line. This will use the composer.json and composer.lock file to install the related modules.
@@MarkShust I mean I already install Magento following your tutorial. But my friend has Magento version Enterprise. So, I can simply copy his composer.json and composer.lock, then run command 'bin/composer install'. Does this work 😂
@@Ethan-n2z no, I'm not recommending that way because it makes no sense :) Get the auth.json from your coworker and set this up the right way! Copying the vendor directory around is all kinds of horribleness and wrong.
Hi Mark, Unbelievable job of yours , great! I get this error, what can i do? I am a real beginner. WSL (10) ERROR: CreateProcessEntryCommon:505: execvpe /bin/bash failed 2 WSL (10) ERROR: CreateProcessEntryCommon:508: Create process not expected to return
Hey Gerwin, thanks! There isn't official WSL support which is probably why 😅. However, many are running this setup with WSL2 and I'd recommend checking out the discussion on GitHub at github.com/markshust/docker-magento/discussions/372 for more info related to this setup. I don't run Windows, so I'm sorry that I won't be much help here. Hope this helps! -M
Thanks, You can avoid giving alias to original magento commands. new comers might get issues when they try to fix a issue by themself. typical dev will not spend time explain alias and docker coz they also might not know
I use an M1 MBP Max with 64GB RAM and a 4TB SSD (which does speed up I/O a bit) - it’s the first computer in the last decade that I’ve loved, and it performs insanely well. You may be able to get similar performance with a newer MBA though with maxed out RAM. The new M computers are so fast.
Hello Mark, excellent work. Thank you. How can I change the port from 80 to something else? Port 80 is already in use on my computer. I tried stopping it and running again with a different port but I am getting the following error: host not found in upstream "phpfpm" in /etc/nginx/conf.d/default.conf:24 nginx: [emerg] host not found in upstream "phpfpm" in /etc/nginx/conf.d/default.conf:24
Yes, you can update the compose.yaml file and update the app service to point from port 80 to your desired port (for example, 8080:80 to expose it to port 8080 on your host). You’ll also need to update the site base url config value. Note there are gotchas with https and the like, so you’ll need to do some digging there.
The problem with running HTTP is that some modules and code will not work correct, as all eCommerce sites are meant to be ran over HTTPS. But there is no reason that you can't run a domain locally with HTTPS! docker-magento uses something called mkcert which generates self-signed SSL certificates to be executed on your local machine, so you can run things locally, but still have HTTPS. There are also other solutions that exist that can help with this, such as ngrok or traeffik.
This is a bit tricky for me as I don’t run Windows. I’ll see what I can do, but in the meantime you can check out this discussion on GitHub for info on how to get this setup working on Windows with WSL2 github.com/markshust/docker-magento/discussions/372
Hi, Thank you for this tutorial, I can install Magento 2 successfully at the first time. But I can not make a change. When I edit a .phtml file, it does not reflect on the website. I'm sure that I edit on the right file (I enabled template hint). Also, I enable developer mode, and run some commands: bin/magento setup:static-content:deploy -f, bin/magento cache:flush. Can you help me with this. Thank you!
Hi Ethan, great to hear that it installed quickly. Where exactly are you making the updates? If you are outside of app/design or app/code, the changes will not sync. It is purposely set up that way for performance reasons. You shouldn't need to run content deploy commands or anything like that to get your updates to reflect.
@@MarkShust I tried to make changes directly inside vendor, but it doesn't sync. However, I figured a way to override it in app/code and it work fine now. Thank you!
@@Ethan-n2z yes, that vendor directory isn't synced for performance reasons. I always recommend developing in the app directory, but if you do need to edit inside of vendor, you could always add the very specific directory (don't add the entire vendor directory) to the compose.dev.yaml file and then restart the containers. You could also use the bin/copytocontainer command to get your changes up in the vendor directory on the container.
@MarkShust Hi!!! Hope you're doing great! Quick question how can i access the magento db or phpmyadmin? i saw that docker has a service running and it points to localhost:8080:80 but it is not working. Any thoughts? Thank you so much!!!
Inside the Docker container, it will be accessible at the "db" host because that's how the MySQL service is set up in the compose.yaml file. But outside of the container, the db will be accessible by localhost:3306, as the port is also bound back to the host in that same file.
Everything is going smoothly for me, I need help on one thing, my application is also running on the same port can we change 6379 port of redis, so that my application dont give me any error, i cant change the the port of my application due to some client requirement
Yes, you have the ability to edit the compose.yaml file after the installation. This includes modifying the ports as well. You can set something like "63790:6379" in the compose.yaml for Redis, which would expose the 6379 port on the container to 63790 on the host. Also, this environment is meant for development, so it should be of no concern to your client as to how or what ports you run Magento on for development.
Anyone facing the problem with M2 chip states that "chmod: cannot access 'bin/magento': No such file or directory"?? and thanks alot Mark you save all of us time cheers
Glad I saved you some time! It sounds like your install failed, so I’d attempt to reinstall it again and note if/when you get an error message during the install.
@@MarkShust Having The same issue stated above "chmod: cannot access 'bin/magento': No such file or directory". Any quick fix for this? BTW thanks for saving our time :)
@@MarkShust How to incorporate blocks of content, banners and elements created by for example mkt team into our theme, also how to create a theme from the beginning or modify as needed the one that marketing picks. Hope i made sense lol. Thank you!
@@tajazc thanks for the suggestion! I did just recently make a course on Magento 2 theming essentials, info on that is at m.academy/courses/magento-2-power-theming/ I'll consider making some additional content for incorporating designs created from a team as your suggested content, banners, etc., as that's a great real-life scenario that we do all the time 👍
@@MarkShust Hi again. Quick question tho. Ecommerce store in my local mac is working great! Again thank you for the solution! The only thing is that i do not see the folders inside the vendor folder. I have been reading and people say to run composer install? But i am not sure if that would mess up the setup i already have going on/working. Thank you!!! Any input will be super appreciated.
Hello Mark, i hope you are doing fine. I get the following message after trying to login to admin page: "You need to configure Two-Factor Authorization in order to proceed to your store's admin area An E-mail was sent to you with further instructions" How can i change the credentials? I really appreciate your help.
Hi Zaki, that's because 2FA is enabled by default in all Magento 2 installs. So, you'll need to either setup 2FA with your phone or authenticator app, or install my "disable 2FA" module! github.com/markshust/magento2-module-disabletwofactorauth -- this was such a common annoyance of mine that I made a module to automatically disable it if you are in developer mode.
Hi Mark, thank you for your support :) I already solved the issue by running the php bin/magento module:disable Magento_TwoFactorAuth command. @@MarkShust
Yes, I think I can! In the mean time, you can check out the "Existing Projects" documentation at github.com/markshust/docker-magento#existing-projects which explains how you would be able to do this.
Excuse me, I follow your step, but it didn't run. I wanna use version 2.4.5 Because my local MySQL use port 3306 which is the same as MariaDB, so I changed the MariaDB to 3307.
You'll need to disable all local services first to use this setup. If you change the ports, you'll also need to update the related config inside the Magento instance to account for the update. I usually don't recommend this as it just adds complexity, better to simply stop/start local services when needed instead.
It's not "officially" supported, but many are using this exact setup on WSL2. I don't have it documented anyplace, but there is a lot of useful info about this over at github.com/markshust/docker-magento/discussions/372
Running WSL on windows. Installation stops and gives this error - There must be at least 6GB of RAM allocated to Docker in order to continue. I already created .wslconfig file and given 6GB but still it gives the error. plz help.
@@user-of7me2ex3ySorry, I don't know as I don't use WSL2. You can see the thread at github.com/markshust/docker-magento/discussions/372 or chime in and perhaps someone can help you up there.
Not works for me completely (MacbookProM1). Anything I do caused an error "directory index of "/etc/nginx/html/" is forbidden". Tried to google it, tried a million solutions from the web, but nothing worked as expected, have the same error. Mark, do you have any solution how to fix it?
Are you using docker-magento or another Docker-based Magento dev env? My setup doesn't use or depend on the /etc/nginx/html directory at all (the root is /var/www/html), so this is the first time I've ever heard of this. I've used a MBP M1 with this setup for the last few years without any issues. In any case, you can completely remove your setup and try again using the instructions at github.com/markshust/docker-magento?tab=readme-ov-file#misc-info. Also ensure your Docker Desktop file permissions weren't changed around, and that the root of your site is located within your Mac user home directory and not some rando location. Hopefully one of these tips helps!
When I run the script, I end up getting the following message: [ErrorException] otouch(): Unable to create file /var/www/.composer.json because Permission denied Does it happen to anyone else? how have you solved it? i tried with 2 virtual machines and ubuntu 22.04.02 LTS :(
Hi Carlos, sounds like your composer is owned by the "root" user on your host. Composer should never be owned by root on your host machine, but rather your local username. You'll want to reset all of the ownerships of your local ~/.composer dir, which should resolve the issue.
@@MarkShust Thanks a lot for this video and system. I've been banging my head all day long untill I found this. Sadly the credentials in the .env file result in "The account sign-in was incorrect or your account is disabled temporarily. Please wait and try again later." Any idea why?
@@kimdevylder3778 it sounds like your account was locked out, which can happen if you have multiple failed login attempts. It's a security measure put in place by Magento that prevents brute-force login attempts. Luckily, you can easily unlock this from command line with: bin/magento admin:user:unlock john.smith
@@MarkShust Thanks a lot for your fast reply! Sadly this did not work. Terminal returned "The user account "john.smith" was not locked or could not be unlocked" but I still can not login using those credentials. However, I found a way to create a new administrator account via Terminal and turn off Two Factor Authentication (I can not make email work, yet). I tried posting the links to information about that here for other users but my reply disapeared. Anyhow, I made it in but it wasn't easy ;-)
Hi Mark, can you confirm if this is for a Mac OS environment running docker? I've tried setting up Magento 2 locally with Windows before using Linux subsystem, but it was running very slow and impossible to use so looking to either use my Macbook now or directly on Linux system thanks
Yes, this video is for macOS. I find Windows + WSL confusing and always recommend macOS over Windows (sorry for starting a platform battle here, but those are my thoughts).
Database changes work exactly the same as any other Magento install. Email is handled by a container, and you can access it by going to magento.test:1080. You can also disable 2FA for development using github.com/markshust/magento2-module-disabletwofactorauth
Yeah, I figured out the email thing. What I meant in regards to the database was, I added a new user and it was still there when I docker compose down and started it back. In my limited experience with docker the database is mostly reverted back missing the changes. Curious to know how you handled this.
since MySQL is a persistent database, it should be stored and retained on the filesystem. You simply need to assign a volume to the container, and the data will persist reboots. This is what I do with this setup. If you don’t assign a volume, data is isn’t persisted and you’ll typically get a fresh filesystem on every system reboot.
Okay, I look into. New to docker so learning as I go. Been developing Magento since version 1. I remember a year or so back I found your M Academy site, even with my years of experience in Magento 2.. I still love going through other developer course, great way to see how other people approach the concepts.
Hi Raul, this uses the composer auth.json from your local host machine (or the info from auth.json in your sec/ directory if it’s present and linked up in the dev YAML file). So I would recommend to check the contents of your ~/.composer/auth.json to see if your Magento creds are setup there first.
@@alexis-ibarra-hstashit's hard for me to say without seeing it, however I'd recommend blowing everything away (instructions at github.com/markshust/docker-magento#misc-info) and trying a fresh install of docker-magento.
Thank you, I wanted to refer to when I put the @MarkShust ~/.composer/auth.json in the command line and it said No such file or directory, then I created this folder and copy this file from /home/alexis/.config/composer/auth.json to /home/alexis/.composer/auth.json @@MarkShust
Hi Jose, it's possible that you have something else running on port 9000. If running bin/status doesn't show the phpfpm container running (as will be the case with the error message you are receiving), you'll need to further diagnose why this container is failing to start.
Has anyone figured out how to update components like nginx, mariadb? i tried to fork and set the new versions in the compose.yaml but seems that it mess with other settings.
Hey there! I have a video on how to edit Nginx config files at courses.m.academy/courses/487758/lectures/9064349 -- if that doesn't help, please let me know. I could always add additional lessons to the course if needed.
Unfortunately Docker support on Windows isn’t that good. It’s a bit of a Frankenstein app with WSL2. I’m looking out for alternative options and may have something soon.
I installed the Ubuntu server, installed Docker, the installation was successful, the containers started, and it gave me the error: "Creating a "magento/project-community-edition=2.4.6-p3" project at "./" In CreateProjectCommand.php line 371: Project directory "/var/www/html/." is not empty." I don’t have such a directory, I tried to create it, but the error remains. Can you tell me which direction to go to solve the problem?
About 2.5GB, as that is the total of all of the Docker images downloaded in this setup. You can confirm this by running "docker images" from the CLI after installation.
Hi Hugo, I don’t officially support Windows yet, however many have ran it on Windows with WSL2. You can see the related GitHub Discussion at github.com/markshust/docker-magento/discussions/372
Great question Cid. I made a video that covers how to setup an auth.json file with Magento creds, and you can watch it at courses.m.academy/courses/487758/lectures/8974570
while installing 2.4.6 Warning: file_put_contents(C: \xampp \htdocs \eagento2 \var\cache\ leage-tags\mage---Ca3_REFLECTION) : Falled to open strean: Resource temporarily unavailable in C:\amp p\htdocs \magento2\vendor\colinmollenhour\cache-backend-file\File.php on line 710
mark this repo is a lifesaver! i spent almost a week trying to setup magento and docker magento worked so smoothly simply amazing!
That is so great to hear. I’m glad you’ve found it so useful 🧡
You're a genius! I found a lot of Docker images, tutorials, and stuff, but after three days of struggling, I'm amazed at how easy it was with your script! It simply worked!
I don’t know about the genius part 😂 but that’s so great to hear!! 🎉
You are a LIFE SAVER! I tried so long to figure this out on my own before I found your amazing script and course. Thank you so much!!
Awesome, really glad it was helpful to you Rachel! 🤜🤛 Feel free to tell your friends about it too 🤗
It’s definitely helped my setup time. I had my own docker setup but using it with multiple different project always required a bunch of tweaking. But your set up has made it 1000% easier
Great to hear! 🙌
Why did I fin your channel so late. Thank you for your time!
Glad you like my channel! 😎 Appreciate it.
Bro, feeling the video, I just appreciate your effort in all this, keep a look out for ...
Appreciate it Emile, will have many more videos on the way soon 👍
Hi Mark thanks for the amazing amount of effort that you put into this project. One question would be could this be used to run Magento2 on a VPS server live? If yes what changes need to be made to make it run securely? If not what steps must I take to get Magento2 running as quick, easily, and securely as possible?
Hi there - thanks for the kind words! This environment is meant for development, so some updates would need to be made for prod, including customizing the images and such. I don’t have a formal process for this and generally leave it up to each use-case to implement at the moment, though I am thinking through deployment options.
Great script! Do you also have a tutorial, how to move from a huge old classical Magento (2.3.7) installation to a nice state of the art docker magento environment?
Hi Matthias! I'm sorry that I do not -- 2.3.7 is ancient! I'd recommend getting Magento up to speed on the first version that supports both PHP 7.3 and 8.1, which I believe is 2.4.3. Once at that point, it shouldn't be much of a reach to get things set up on docker-magento. Some old tags also support 2.3.x, but you'll need to search for those through the documentation/commits as it's been a while. I'd recommend not falling behind Magento more than 2 versions at any given time. -Mark
Thank you Mark. You are a life saver. 🙏🏻
Sure thing, glad it was helpful to you!
Now during installation, it requires Public and Private Access Keys which can be created on Adobe website.
Hey Duke, these keys have always been required for as long as I can remember. Info on how to set these keys up is at courses.m.academy/courses/487758/lectures/8974570
Hi mark,
i am facing this issue in my container logs,
[Error] APM: Locking APM for 300 seconds for reason: Cannot connect to the agent"
can you please guide?
Hi Hallar, I'm sorry I have not had this issue, but it was reported in the past. Please see github.com/markshust/docker-magento/issues/700 and follow up with any additional info that would help us resolve this unique error. Thanks! -M
Hi, I have a question, Im trying to have a very energy efficient server. and trying to move to an ARM64 Cluster, Is it possible to install magento safely or not yet?
Hey Bruno -- yes, this should be no problem at all. My Docker images are built for dual-compatibility for both Intel and Mac ARM chips, and Magento runs completely fine without any issues. -Mark
How to install ssl let's encrypt certificate ?
This project uses mkcert, so it doesn’t depend upon third-party services. You could integrate Let’s Encrypt though by using their provided instructions with Docker + Nginx.
Hello sir, when I use your steps to install Magento 2, I often encounter this error. What is the problem?
chmod: cannot access 'bin/magento': No such file or directory
It appears as though your install failed for some reason. I’d recommend blowing it away and trying again, noting any errors that may be thrown in the terminal during the install process. Info of how to do this and this error is in the GitHub readme.
I followed the manual steps and it stopped at container started and the logs in the container shows Closed keepalive connection. Not sure what I did wrong, but maaaan Magento is difficult to get started with
It’s hard to tell what’s going on without seeing it, but bin/status should show all containers in an active state. If not, please open up a new Discussion on GitHub so you can try to get this resolved. There are usually no problems running this out of the box.
Thank you, Mark, for the simplicity of installing Magento. You're a boss !! However, I have a seemingly simple issue. On the admin page, I don't know which username and password to use. I am a complete amateur with Magento and have been struggling for hours. Thank you for your response.
Thanks 😊 The admin creds are in the env/magento.env file. Note that I have a full course available on this and many more things at m.academy/courses/set-up-magento-2-development-environment-docker/. You can also install my DisableTwoFactorAuth module on GitHub at github.com/markshust/magento2-module-disabletwofactorauth which automatically disables 2FA when developer mode is activated.
@@MarkShust Thank you, Mark, for your quick response! I entered the credentials from the db.env file, but I think they correspond to MySQL. However, I inserted the credentials from the magento.env file (your credentials). It asks for two-factor authentication 😭. Thank you for the link, I will check it out!
@@mattew862 ah sorry about that! I meant to say to use the env/magento.env file. 2FA is required for Magento and you'd need to set that up... or use my trusty DisableTwoFactorAuth module that I made just for this reason! It auto-disables 2FA when developer mode is enabled. You can get it on GitHub at github.com/markshust/magento2-module-disabletwofactorauth
@@MarkShust I used your link. It installed correctly. The problem persists. I went through all the steps. Everything works. But I still can't log in to the dashboard. I changed the username, password. Same result. I'm close to giving up. Thank you for your advice. I wouldn't want to clutter the comment space.
@@mattew862 I have a feeling that you are not prefacing your composer command with "bin/". So rather than typing "composer", type "bin/composer". This ensures that composer executes within the docker container and installs the code in the correct location. If you instead run Composer locally, it will only install in a local directory. See my course -- it fully covers this and much more! I've installed Magento hundreds of times on new computers, and it works every time.
I get this error when running the curl command: Error response from daemon: Ports are not available: exposing port TCP 0.0.0.0:80 -> 0.0.0.0:0: listen tcp 0.0.0.0:80: bind: address already in use
Hi Ravi -- sounds like you have another service running locally (either Apache, Nginx, MAMP, etc.), so you'll need to stop that service in order to run docker-magento due to the way host-bind mounts work with Docker.
but sir how we go to admin panel of m2.test
m2.test/admin 😄. See the env/db.env file for creds.
Hi Mark Shut, i tried this way many times, but it always show me this error :chmod: cannot access 'bin/magento': No such file or directory
, Pls help.Tks
It sounds like your installation failed, as that should work out of the box. I’d recommend opening up a new discussion thread on GitHub about this.
Magento has a headless eCommerce architecture right? How easy is it to connect a customized frontend to the backend? Do you have videos for building frontends? I am not so fit with the backend and I would like to know if a webshop with magento is relatively easy to realize in your opinion :)
Magento is anything but easy. It's a commitment, because it is very powerful, but with that power comes great responsibility. It comes with a full GraphQL implementation in which you can build a completely custom frontend if you wish, but you'd need to have fairly extensive experience to go down this route. I typically recommend everyone to use Hyvä, but if you are using the built-in theming setup (Luma), I'd very much recommend taking my course on theming at m.academy/courses/magento-2-power-theming/. As far as headless frontends, there are platforms out there such as Vue Storefront which makes this approach less of a reach (still very involved though).
@@MarkShust Thank you very much for the detailed answer. I am just in my last year of my computer science studies and wanted to deepen my knowledge in ecommerce and therefore create my own web store. As soon as I have the financial means I will definitely look into your course, thanks again!!!
Thank you, but when i tried to login to admin dashboard using provided credentials in the env it says "The account sign-in was incorrect or your account is disabled temporarily. Please wait and try again later.". what did i miss ?
Hi there, it sounds like your account was locked out from too many failed login attempts. It's a security measure put in place by Magento that prevents brute-force login attempts. Luckily, you can easily unlock this from command line with: bin/magento admin:user:unlock john.smith
Mr Shust - Many thank yous for creating the Docker-Magento solution! Which host do you recommend for deploying Magento as a Docker container? I tried Heroku, but I'm struggling to get the 8 images to run without crashing. My guess is I need to include the prefixes in the images names/tags (eg linuxserver/phpmyadmin as opposed to phpmyadmin). But Heroku's "release" command doesn't seem to like those forward slashes. Any ideas?
Thanks! I generally recommend a managed hosting solution at this time, as simply figuring out how to deploy Magento is super time consuming (I’d rather stick with writing code). It is a problem that I’m thinking about. That said, I’d recommend looking up Damien’s Kubernetes setups to learn how to run a proper containerization setup for Magento.
@@MarkShust Thanks for the response Mark! Do you know of anyone who has successfully deployed your Docker-Magento solution to a host? It is working fine on my machine. But I want to deploy it to a host and make it publicly available as an actual store for my daughter.
@@pslamba I don't, but feel free to try it out!
Mark Thank you. I was able to install successfully!
I've changed something in file, cleared cache but nothing changed in frontend. What did I miss? Do I need any docker command?
Hi Asad, glad it installed successfully for you! It’s possible you are trying to modify a file or folder that is not set up to be bidirectionally synced. Only files or folders listed in the compose.dev.yaml file are synced.
Hi Mark. Here I am again with another question. My friend has an Abode Enterprise and he setup his local successfully. Then he zip his vendor folder and send me. Can I replace that with my vendor. Do I need to run any commands to make it works. I only use this for my local dev. Thank you very much
Hi Ethan, this is the entirely wrong workflow to use with Composer. There is no need to copy & paste the vendor folder around -- simply run "bin/composer install" from the command line. This will use the composer.json and composer.lock file to install the related modules.
@@MarkShust I mean I already install Magento following your tutorial. But my friend has Magento version Enterprise. So, I can simply copy his composer.json and composer.lock, then run command 'bin/composer install'. Does this work 😂
@@Ethan-n2z yep 😄. You’ll probably just need his composer auth.json info to authenticate against the enterprise repo.
@@MarkShust Ohhh, that's too bad, I don't have auth.json 😭😭😭 Is there a workaround that I can do with his vendor folder?
@@Ethan-n2z no, I'm not recommending that way because it makes no sense :) Get the auth.json from your coworker and set this up the right way! Copying the vendor directory around is all kinds of horribleness and wrong.
Hi Mark, Unbelievable job of yours , great! I get this error, what can i do? I am a real beginner. WSL (10) ERROR: CreateProcessEntryCommon:505: execvpe /bin/bash failed 2
WSL (10) ERROR: CreateProcessEntryCommon:508: Create process not expected to return
Hey Gerwin, thanks! There isn't official WSL support which is probably why 😅. However, many are running this setup with WSL2 and I'd recommend checking out the discussion on GitHub at github.com/markshust/docker-magento/discussions/372 for more info related to this setup. I don't run Windows, so I'm sorry that I won't be much help here. Hope this helps! -M
Thanks, You can avoid giving alias to original magento commands. new comers might get issues when they try to fix a issue by themself. typical dev will not spend time explain alias and docker coz they also might not know
Yes, I don't recommend aliasing the original Magento commands. Simply aliasing "m" to "bin/magento" is usually enough for me!
What Mac do you use for Magento 2 development and how well does it work?
I use an M1 MBP Max with 64GB RAM and a 4TB SSD (which does speed up I/O a bit) - it’s the first computer in the last decade that I’ve loved, and it performs insanely well. You may be able to get similar performance with a newer MBA though with maxed out RAM. The new M computers are so fast.
Hello Mark, excellent work. Thank you. How can I change the port from 80 to something else? Port 80 is already in use on my computer. I tried stopping it and running again with a different port but I am getting the following error: host not found in upstream "phpfpm" in /etc/nginx/conf.d/default.conf:24
nginx: [emerg] host not found in upstream "phpfpm" in /etc/nginx/conf.d/default.conf:24
Yes, you can update the compose.yaml file and update the app service to point from port 80 to your desired port (for example, 8080:80 to expose it to port 8080 on your host). You’ll also need to update the site base url config value. Note there are gotchas with https and the like, so you’ll need to do some digging there.
Can we host it to localhost instead of HTTPS, if yes it will be really helpful
The problem with running HTTP is that some modules and code will not work correct, as all eCommerce sites are meant to be ran over HTTPS. But there is no reason that you can't run a domain locally with HTTPS! docker-magento uses something called mkcert which generates self-signed SSL certificates to be executed on your local machine, so you can run things locally, but still have HTTPS. There are also other solutions that exist that can help with this, such as ngrok or traeffik.
Thanks for sharing but i am still strugling on windows. can you make a video how to download and install on window Please.
This is a bit tricky for me as I don’t run Windows. I’ll see what I can do, but in the meantime you can check out this discussion on GitHub for info on how to get this setup working on Windows with WSL2 github.com/markshust/docker-magento/discussions/372
@@MarkShust Thanks for sharing. i'll do
Hello, I have VMware running on the 80 & 443 port. Is there any other way I get get to install this without it conflicting?
Yes, you can change the ports in compose.yaml (host:container) and update the site’s base URL.
@@MarkShust thank you.
Hi, Thank you for this tutorial, I can install Magento 2 successfully at the first time. But I can not make a change. When I edit a .phtml file, it does not reflect on the website. I'm sure that I edit on the right file (I enabled template hint). Also, I enable developer mode, and run some commands: bin/magento setup:static-content:deploy -f, bin/magento cache:flush. Can you help me with this. Thank you!
Hi Ethan, great to hear that it installed quickly. Where exactly are you making the updates? If you are outside of app/design or app/code, the changes will not sync. It is purposely set up that way for performance reasons. You shouldn't need to run content deploy commands or anything like that to get your updates to reflect.
@@MarkShust I tried to make changes directly inside vendor, but it doesn't sync. However, I figured a way to override it in app/code and it work fine now. Thank you!
@@Ethan-n2z yes, that vendor directory isn't synced for performance reasons. I always recommend developing in the app directory, but if you do need to edit inside of vendor, you could always add the very specific directory (don't add the entire vendor directory) to the compose.dev.yaml file and then restart the containers. You could also use the bin/copytocontainer command to get your changes up in the vendor directory on the container.
@@MarkShust thank you. That is much clearer
@MarkShust Hi!!! Hope you're doing great! Quick question how can i access the magento db or phpmyadmin? i saw that docker has a service running and it points to localhost:8080:80 but it is not working. Any thoughts? Thank you so much!!!
Inside the Docker container, it will be accessible at the "db" host because that's how the MySQL service is set up in the compose.yaml file. But outside of the container, the db will be accessible by localhost:3306, as the port is also bound back to the host in that same file.
Everything is going smoothly for me, I need help on one thing, my application is also running on the same port can we change 6379 port of redis, so that my application dont give me any error, i cant change the the port of my application due to some client requirement
Yes, you have the ability to edit the compose.yaml file after the installation. This includes modifying the ports as well. You can set something like "63790:6379" in the compose.yaml for Redis, which would expose the 6379 port on the container to 63790 on the host. Also, this environment is meant for development, so it should be of no concern to your client as to how or what ports you run Magento on for development.
How to install in a VPS with Portainer? Where can I choose the ports?
I really don’t have a clue. I use the YAML files to configure everything. So, check out compose.yaml to do this.
Anyone facing the problem with M2 chip states that "chmod: cannot access 'bin/magento': No such file or directory"?? and thanks alot Mark you save all of us time cheers
Glad I saved you some time! It sounds like your install failed, so I’d attempt to reinstall it again and note if/when you get an error message during the install.
@@MarkShust Having The same issue stated above "chmod: cannot access 'bin/magento': No such file or directory". Any quick fix for this? BTW thanks for saving our time :)
thank you very much, can you make a tutorial video for frontend developer?
I’ll see what I can do. What exactly in the Magento frontend would you like me to cover? There are 50+ topics for me to choose from 😄
@@MarkShust How to incorporate blocks of content, banners and elements created by for example mkt team into our theme, also how to create a theme from the beginning or modify as needed the one that marketing picks. Hope i made sense lol. Thank you!
@@tajazc thanks for the suggestion! I did just recently make a course on Magento 2 theming essentials, info on that is at m.academy/courses/magento-2-power-theming/
I'll consider making some additional content for incorporating designs created from a team as your suggested content, banners, etc., as that's a great real-life scenario that we do all the time 👍
@@MarkShust Hi again. Quick question tho. Ecommerce store in my local mac is working great! Again thank you for the solution! The only thing is that i do not see the folders inside the vendor folder. I have been reading and people say to run composer install? But i am not sure if that would mess up the setup i already have going on/working. Thank you!!! Any input will be super appreciated.
Hello Mark, i hope you are doing fine. I get the following message after trying to login to admin page: "You need to configure Two-Factor Authorization in order to proceed to your store's admin area
An E-mail was sent to you with further instructions" How can i change the credentials? I really appreciate your help.
Hi Zaki, that's because 2FA is enabled by default in all Magento 2 installs. So, you'll need to either setup 2FA with your phone or authenticator app, or install my "disable 2FA" module! github.com/markshust/magento2-module-disabletwofactorauth -- this was such a common annoyance of mine that I made a module to automatically disable it if you are in developer mode.
Hi Mark, thank you for your support :)
I already solved the issue by running the php bin/magento module:disable Magento_TwoFactorAuth command. @@MarkShust
What could be the reason why changes is not reflecting?
Hi Zargam, not exactly sure what changes those are, but I’d recommend opening up a new discussion on GitHub.
Can you make a tutorial on how to install that when you already have such a project live and you need it locally.
Yes, I think I can! In the mean time, you can check out the "Existing Projects" documentation at github.com/markshust/docker-magento#existing-projects which explains how you would be able to do this.
@@MarkShust would be so awesome please make a video youre my hero. But please on windows xD
@@WolfszeitYTsorry I don’t do Windows 😮
Excuse me, I follow your step, but it didn't run.
I wanna use version 2.4.5
Because my local MySQL use port 3306 which is the same as MariaDB, so I changed the MariaDB to 3307.
You'll need to disable all local services first to use this setup. If you change the ports, you'll also need to update the related config inside the Magento instance to account for the update. I usually don't recommend this as it just adds complexity, better to simply stop/start local services when needed instead.
Can this be used with a windows based system?
It's not "officially" supported, but many are using this exact setup on WSL2. I don't have it documented anyplace, but there is a lot of useful info about this over at github.com/markshust/docker-magento/discussions/372
I got the error
"service "phpfpm" is not running"
How can i fix this ?
sorry for my bad English
It could be a number of reasons. Feel free to create a new discussion thread about this on GitHub at github.com/markshust/docker-magento/discussions
Running WSL on windows. Installation stops and gives this error - There must be at least 6GB of RAM allocated to Docker in order to continue. I already created .wslconfig file and given 6GB but still it gives the error. plz help.
Try increasing it a tad more... there's a level of variance, even another 250MB may be enough 👍
@@MarkShust given 8GB but still same error.
.wslconfig file contents below - (anything i am doing wrong ?)
[wsl2]
memory=8GB
@@user-of7me2ex3ySorry, I don't know as I don't use WSL2. You can see the thread at github.com/markshust/docker-magento/discussions/372 or chime in and perhaps someone can help you up there.
@@MarkShust sure thanks
Not works for me completely (MacbookProM1). Anything I do caused an error "directory index of "/etc/nginx/html/" is forbidden". Tried to google it, tried a million solutions from the web, but nothing worked as expected, have the same error. Mark, do you have any solution how to fix it?
Are you using docker-magento or another Docker-based Magento dev env? My setup doesn't use or depend on the /etc/nginx/html directory at all (the root is /var/www/html), so this is the first time I've ever heard of this. I've used a MBP M1 with this setup for the last few years without any issues. In any case, you can completely remove your setup and try again using the instructions at github.com/markshust/docker-magento?tab=readme-ov-file#misc-info. Also ensure your Docker Desktop file permissions weren't changed around, and that the root of your site is located within your Mac user home directory and not some rando location. Hopefully one of these tips helps!
please help me to set custom log file in current magento docker because facing lots of issue related to file permission
It’s no different from creating a custom log file in a non-docker-magento project.
Suggest me any genuine link to set custom log file which can definitely works with magento setups with docker using your m2 docker
@@MarkShust
Suggest me any genuine link to set custom log file which can definitely works with magento setups with docker using your m2 docker
When I run the script, I end up getting the following message:
[ErrorException] otouch(): Unable to create file /var/www/.composer.json because Permission denied
Does it happen to anyone else? how have you solved it? i tried with 2 virtual machines and ubuntu 22.04.02 LTS :(
Hi Carlos, sounds like your composer is owned by the "root" user on your host. Composer should never be owned by root on your host machine, but rather your local username. You'll want to reset all of the ownerships of your local ~/.composer dir, which should resolve the issue.
Is it possible to use this with PHP 7.4?
in your repositories the directory with PHP 7.4 has been deleted
Yes, while PHP 7 has been deprecated and is EOL, the last tagged versions can still be used and downloaded from Docker Hub.
What are the 'username' and 'password' values used for on the admin screen?
Hi Matheus, these are set from the magento.env file at github.com/markshust/docker-magento/blob/master/compose/env/magento.env
@@MarkShust Thanks a lot for this video and system. I've been banging my head all day long untill I found this. Sadly the credentials in the .env file result in "The account sign-in was incorrect or your account is disabled temporarily. Please wait and try again later." Any idea why?
@@kimdevylder3778 it sounds like your account was locked out, which can happen if you have multiple failed login attempts. It's a security measure put in place by Magento that prevents brute-force login attempts. Luckily, you can easily unlock this from command line with: bin/magento admin:user:unlock john.smith
@@MarkShust Thanks a lot for your fast reply! Sadly this did not work. Terminal returned "The user account "john.smith" was not locked or could not be unlocked" but I still can not login using those credentials. However, I found a way to create a new administrator account via Terminal and turn off Two Factor Authentication (I can not make email work, yet). I tried posting the links to information about that here for other users but my reply disapeared. Anyhow, I made it in but it wasn't easy ;-)
@@kimdevylder3778 it sounds like there were too many failed login attempts. You can unlock it with the "bin/magento admin:user:unlock" command 😄
Hi Mark, can you confirm if this is for a Mac OS environment running docker? I've tried setting up Magento 2 locally with Windows before using Linux subsystem, but it was running very slow and impossible to use so looking to either use my Macbook now or directly on Linux system thanks
Yes, this video is for macOS. I find Windows + WSL confusing and always recommend macOS over Windows (sorry for starting a platform battle here, but those are my thoughts).
Thanks for confirming@@MarkShust I completely agree with the windows subsystem. It's not the best in my experience either.
How does this handle database changes? Also created another user through the command line and not receiving the email for the 2FA.
Database changes work exactly the same as any other Magento install. Email is handled by a container, and you can access it by going to magento.test:1080. You can also disable 2FA for development using github.com/markshust/magento2-module-disabletwofactorauth
Yeah, I figured out the email thing. What I meant in regards to the database was, I added a new user and it was still there when I docker compose down and started it back. In my limited experience with docker the database is mostly reverted back missing the changes. Curious to know how you handled this.
since MySQL is a persistent database, it should be stored and retained on the filesystem. You simply need to assign a volume to the container, and the data will persist reboots. This is what I do with this setup. If you don’t assign a volume, data is isn’t persisted and you’ll typically get a fresh filesystem on every system reboot.
Okay, I look into. New to docker so learning as I go. Been developing Magento since version 1. I remember a year or so back I found your M Academy site, even with my years of experience in Magento 2.. I still love going through other developer course, great way to see how other people approach the concepts.
Hey Mark! Great video, but there's no support to access keys. I Keep getting HTTP/2 403 when the script tries to download it
Hi Raul, this uses the composer auth.json from your local host machine (or the info from auth.json in your sec/ directory if it’s present and linked up in the dev YAML file). So I would recommend to check the contents of your ~/.composer/auth.json to see if your Magento creds are setup there first.
@@MarkShust Hi mark I just to checked it up but it says No such file or directory, What would you recommend me? thank you
your video is incredible
@@alexis-ibarra-hstashit's hard for me to say without seeing it, however I'd recommend blowing everything away (instructions at github.com/markshust/docker-magento#misc-info) and trying a fresh install of docker-magento.
Thank you, I wanted to refer to when I put the @MarkShust ~/.composer/auth.json in the command line and it said No such file or directory, then I created this folder and copy this file from /home/alexis/.config/composer/auth.json to /home/alexis/.composer/auth.json @@MarkShust
and now it is founded but it still doesn't work when i put bin/magento sampledata:deploy
I am getting "service `phpfpm" is not running`
Hi Jose, it's possible that you have something else running on port 9000. If running bin/status doesn't show the phpfpm container running (as will be the case with the error message you are receiving), you'll need to further diagnose why this container is failing to start.
Your sign up page sends me into a redirection loop which the browser quits out of.
Hi Terence, I’m sorry to hear that! You can try this direct link which may work better for you: m.academy/library/enroll
Has anyone figured out how to update components like nginx, mariadb? i tried to fork and set the new versions in the compose.yaml but seems that it mess with other settings.
Hey there! I have a video on how to edit Nginx config files at courses.m.academy/courses/487758/lectures/9064349 -- if that doesn't help, please let me know. I could always add additional lessons to the course if needed.
@@MarkShust thanks Mark for leassons and great support.
@@fullgazzsure thing!
@@fullgazzsure thing, appreciate it!
Sure thing @@fullgazz !
Give me step by step video
I have a completely free step-by-step course available at m.academy/courses/magento-2-development-environment-docker/
Doesn't work for me on windows I even installed ubuntu ..etc just more and more of issues!
Unfortunately Docker support on Windows isn’t that good. It’s a bit of a Frankenstein app with WSL2. I’m looking out for alternative options and may have something soon.
I guess it just didn't work for me...
Feel free to create a new Discussion on GitHub and myself or someone else will help you resolve your issue 😊
I installed the Ubuntu server, installed Docker, the installation was successful, the containers started, and it gave me the error:
"Creating a "magento/project-community-edition=2.4.6-p3" project at "./"
In CreateProjectCommand.php line 371: Project directory "/var/www/html/." is not empty."
I don’t have such a directory, I tried to create it, but the error remains. Can you tell me which direction to go to solve the problem?
I found a solution, deleted everything and ran the script again, but now from the root folder and everything worked
Great, glad you figured it out! This is also documented in the README.
how much disk space will it take ?
About 2.5GB, as that is the total of all of the Docker images downloaded in this setup. You can confirm this by running "docker images" from the CLI after installation.
@@MarkShust hello do u have tutorial for those who still uses magento 1.9 ?
Does it work on windows?
Hi Hugo, I don’t officially support Windows yet, however many have ran it on Windows with WSL2. You can see the related GitHub Discussion at github.com/markshust/docker-magento/discussions/372
star comment
I'm not sure what this means or what you'd like me to do here 😅
you skipped many things in this tutorial
I did - it’s only 5 min long!
If you can't manage PHP dependencies then you should probably consider a different profession.
Magento has many PHP dependencies, it's not a matter of "if", it's a matter of "don't want to".
how do i setup the /.composer/auth.jason?
Great question Cid. I made a video that covers how to setup an auth.json file with Magento creds, and you can watch it at courses.m.academy/courses/487758/lectures/8974570
while installing 2.4.6
Warning: file_put_contents(C: \xampp \htdocs \eagento2 \var\cache\ leage-tags\mage---Ca3_REFLECTION) : Falled to open strean: Resource temporarily unavailable in C:\amp p\htdocs \magento2\vendor\colinmollenhour\cache-backend-file\File.php on line 710
Looks like you may be out of memory/RAM.