Skip to content

Prestashop and docker#

Deploy our version of PrestaShop from a custom Docker image.#

Note: This guide is intended for use on a cPouta VM environment! If you haven’t already deployed a VM in cPouta, refer to this guide to set up the VM, obtain a floating IP, and open the necessary ports for external access: Instructions for installing virtual machine(s) in cPouta

  1. Set Up the MySQL Container:

    • Docker will download the mysql:5.7 image if it’s not already on your VM.

    • Replace <your-password> and <your-user> with your MySQL credentials.

    • The database server is 172.17.0.1, and we are exposing port 3307 for it.

    docker run --name prestadb -e MYSQL_ROOT_PASSWORD=<your-password> -e MYSQL_DATABASE=prestadb -e MYSQL_USER=<your-user> -e MYSQL_PASSWORD=<your-password> -p 3307:3306 -d mysql:5.7
    
  2. Pull the Custom PrestaShop Image:

    1. In the presta-shop-service-x repository, go to Deploy --> Container Registry.

    2. Under CLI Commands, if you don’t see a docker pull command, you can modify the docker push command by replacing push with pull.

    3. Replace placeholders marked with x with your unique identifiers.

    docker login gitlab.labranet.jamk.fi:xxxx
    docker pull gitlab.labranet.jamk.fi:xxxx/xxxx/xxxx
    
  3. Run the PrestaShop Container:

    • Replace <your-floating-ip> with your cPouta floating IP, and <prestashop-image-id> with the ID of the PrestaShop image that you pulled from the registry. You can look up the image id by executing the following command:

      docker image ls
      
  4. The example below uses port 8888 for external access, but you can use any other available port. To open the port for an external access, do the following on the cPouta portal:

    1. Go to `Network -> Security groups`.
    
    2. Choose the group that is assigned to your vm and press `Manage Rules`.
    
    3. Press `Add Rule` and add the desired port to the `Port` text box, other settings can be left at default.
    
    4. Finally, click `Add`.
    
    Refer to the aforementioned guide for more detailed explanation on security groups: [Instructions for installing virtual machine(s) in cPouta](https://wimma-capstone.pages.labranet.jamk.fi/support-material/3.%20OPS/guides-and-technologies/CSC%20and%20cPouta/install-csc-cpouta-virtual-machine/#3-create-a-new-security-group)
    
    docker run -p 8888:80 --name prestashop -e PS_DOMAIN="<your-floating-ip>" -e DB_SERVER="172.17.0.1" -e DB_PORT="3307" -e DB_NAME="prestadb" <prestashop-image-id>
    
  5. Go to the installation wizard and setup the website. See this guide on PrestaShop wizard setup: PrestaShop Installation GUI