It's hard to imagine professional web development without Docker. Within minutes, you have entire systems and infrastructures up and running. We have already described how to best use Docker for Magento. This article will be about Shopware.
Docker image selection
When it comes to Docker and Shopware, there is one image that is used lead. Dockware. Why did we choose this service? There are a few very good reasons:
Supports Shopware 5 and Shopware 6 - Even though the current version 6 has been out for a while, there are still more version 5 installations out there.
Very well documented - Docker makes it very easy to install a system like Shopware, but it's still important that the documentation is good. It is especially nice that the makers of the image (This is web) are from Germany, so support can be done a bit easier again.
Open Source - Something is wrong? No problem, just do the needed customization yourself and make a pull request. That's why we love Open Source. Together you always get better. (By the way, this is also the reason why we release our plugins as open source).
We have developed our Shopware Monitoring Plugins both on Dockware and find it a great image, maintained with love.
Once Docker is up and running on the machine, it's just a short walk to the local Shopware store. Since we want to customize a few directories and ports, we decided to write our own
docker-compose.yml right away so we can also put everything in one file.
This is probably the easiest way to start Shopware. The image already contains everything you need: PHP, MySQL, Adminer, XDebug and much more.
As soon as you put the file in the right directory, you can start the system via
docker-compose up -d and access the store via port 80 (HTTP). After that the installation can be done easily. Done. The whole process should not take more than 10 minutes.
Now there are two ways to continue.
Look around: Now that you already have a full-fledged Shopware store up and running, you can look around. Throw the first products into the store and go through the buying process. We feel this is a wonderful option if you come from the Magento or WooCommerce environment, for example, and want to dare to look beyond. But also a great option if you're still running on Shopware 5 and want to take a look at what's new in Shopware 6. Pretty much everything has changed there.
Develop Plugins: Now that Shopware is running, you can also start to extend it and develop your first plugins. The only thing you need to do for this is to customize Docker so that you can access the plugin directory from the outside.
Thanks to Docker this is very easy with a small addition in the
Thus, the local directory
plugins is mounted into the container and can now be accessed from the store. Every plugin that is developed or copied there is immediately available and can be installed and activated via the admin area of the store.
If you want to develop properly, we also recommend XDebug. Fortunately, the PHP extension is anchored in the container and can be used with a small adjustment to the configuration.
As a developer, you naturally want to switch to the command line. This can be done directly from Docker with the following command (at least as long as the container is running):
docker exec -it shopware /bin/bash
Switch between versions
Dockware offers the possibility to install and use Shopware 5 and Shopware 6 in the same way. Only the image has to be changed. For example, if you want to use version 5.6.7, select image: dockware/play:5.6.7. For version 6 you can change to
image: dockware/play:latest to be always up-to-date.
The final version of the Docker configuration we used to develop our Shopware 5 Monitoring Plugin then looks like this: