In this quick blog, I shall provide the method to create a Docker-Compose file of Prestashop.
Pulling the Images
First, we need a MySQL instance of docker. I shall be using
MariaDB mariadb:10.1 since I already have it.
Then, we create a folder which will contain the project.
After that, we create a
docker-compose.yml file, then we start by adding the image.
version = '3' services: # Our Database db: image: 'bitnami/mariadb:10.1' environment: - MARIADB_USER=bn_prestashop - MARIADB_DATABASE=bitnami_prestashop - ALLOW_EMPTY_PASSWORD=yes ports: # I exposed these 2 ports because MySQL use by default 33060, this way we can use either images, MySQL or MariaDB - "3306:3306" - "33060:33060" prestashop: # Pay Special Attention to the name, and watch for the memo bellow image: "prestashop/prestashop:1.7-7.2-fpm" depends_on: - mysql ports: # To Navigate the Project - '80:80' - '443:443' volumes: # So I have access to configuration files of the Perstashop Project - "./config/:/var/www/html/config/"
You can find the images of Prestashop here. This image contains a working PHP, Working Apache/PHP.
Now pay attention to a very important thing. If you want the latest tag, it will be running on PHP 5 at the time of writing this. This is why we changed the tag. If you want to use PHP 7, you need to install the tag responsible for this which is – again at the time of writing this – 1.7-7.2-fpm.
Now we run the package using docker-compose up, I’m not using -d here for debugging purposes and we can start the website once everything is set, we go to localhost on the browser.
When we arrive at the database, you should put db as the address, choose a database config that suits you. Then, voilà, everything is set!