prestashop/base

By prestashop

Updated 8 months ago

Additional layer for PHP images, defined base for PrestaShop containers

Image
5

5M+

prestashop/base repository overview

PrestaShop on Docker

Tests Codestyle

Supported tags

Images by PrestaShop version
  • 8, latest, 8-apache
  • 8-fpm
  • nightly (Latest but unstable release from git)

You can use tags for this. For example:

docker run -ti --name my-docker-name -e PS_DEV_MODE=false -e PS_INSTALL_AUTO=0 -p 8080:80 -d prestashop/prestashop:8.0

What is PrestaShop

PrestaShop is a free and open-source e-commerce web application, committed to providing the best shopping cart experience for both merchants and customers. It is written in PHP, is highly customizable, supports all the major payment services, is translated in many languages and localized for many countries, has a fully responsive design (both front and back office), etc. See all the available features.

PrestaShop's back office dashboard

How to run these images

These images are running with the latest version in the official PHP repository. For the database, you can use and link any SQL server related to MySQL.

Currently if you do not have any MySQL server, the most simple way to run this container is:

# create a network for containers to communicate
docker network create prestashop-net
# launch mysql 5.7 container
docker run -ti --name some-mysql --network prestashop-net -e MYSQL_ROOT_PASSWORD=admin -p 3307:3306 -d mysql:5.7
# launch prestashop container
docker run -ti --name some-prestashop --network prestashop-net -e DB_SERVER=some-mysql -p 8080:80 -d prestashop/prestashop:latest

A new shop will be built, ready to be installed.

You can then use the shop by reaching http://localhost:8080.

The MySQL server can be reached:

  • from the host using port 3307 (example: $ mysql -uroot -padmin -h localhost --port 3307)
  • from a container in the network using the URL some-mysql.

For example, when you reach the "database configuration" install step, the installer will ask for the "server database address": input some-mysql.


However, if you want to customize the container execution, here are many available options:

Environment variableDescriptionDefault value
PS_DEV_MODEThe constant PS_MODE_DEV will be set at true0
PS_HOST_MODEThe constant PS_HOST_MODE will be set at true. Useful to simulate a PrestaShop Cloud environment.0
PS_DEMO_MODEThe constant PS_DEMO_MODE will be set at true. Use it to create a demonstration shop.0
DB_SERVERIf set, the external MySQL database will be used instead of the volatile internal onelocalhost
DB_USEROverride default MySQL userroot
DB_PASSWDOverride default MySQL passwordadmin
DB_PREFIXOverride default tables prefixps_
DB_NAMEOverride default database nameprestashop
PS_INSTALL_AUTOThe installation will be executed. Useful to initialize your image faster. In some configurations, you may need to set PS_DOMAIN or PS_HANDLE_DYNAMIC_DOMAIN as well. (Please note that PrestaShop can be installed automatically from PS 1.5)0
PS_ERASE_DBDrop the mysql database. All previous mysql data will be lost0
PS_INSTALL_DBCreate the mysql database.0
PS_DOMAINWhen installing automatically your shop, you can tell the shop how it will be reached. For advanced users only
PS_LANGUAGEChange the default language installed with PrestaShopen
PS_COUNTRYChange the default country installed with PrestaShopGB
PS_ALL_LANGUAGESInstall all the existing languages for the current version.0
PS_FOLDER_ADMINChange the name of the admin folderadmin
PS_FOLDER_INSTALLChange the name of the install folderinstall
PS_ENABLE_SSLEnable SSL at PrestaShop installation.0
ADMIN_MAILOverride default admin email[email protected]
ADMIN_PASSWDOverride default admin passwordprestashop_demo

If your IP / port (or domain) change between two executions of your container, you will need to modify this option:

Environment variableDescriptionDefault value
PS_HANDLE_DYNAMIC_DOMAINAdd specific configuration to handle dynamic domain0

Documentation

The user documentation (in English by default) is available here.

The developer documentation (English only) can be found here.

Troubleshooting

Prestashop cannot be reached from the host browser

When using Docker for Mac or Docker for Windows (throught WSL), Prestashop cannot be reached from the host browser (gets redirected to "dockeripaddress:8080")

Docker for Mac has an issue with bridging networking and consequently cannot reach the container on its internal IP address. After installation, the browser on the host machine will be redirected from http://localhost:8080 to http://<internal_prestashop_container_ip>:8080 which fails.

You need to set the PS_DOMAIN variable to localhost:8080 for it to work correctly when browsing from the host computer. The command looks something like this:

docker run -ti --name some-prestashop --network prestashop-net -e DB_SERVER=some-mysql -e PS_DOMAIN=localhost:8080 -p 8080:80 -d prestashop/prestashop
Cannot connect to mysql from host - authentication plugin cannot be loaded
ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded: ...

If your mysql image uses MySQL 8, the authentication plugin changed from mysql_native_password to caching_sha2_password. You can bypass this by forcing the old authentication plugin:

docker run -ti -p 3307:3306 --network prestashop-net --name some-mysql -e MYSQL_ROOT_PASSWORD=admin -d mysql --default-authentication-plugin=mysql_native_password
Cannot connect to mysql from host - cannot use socket
ERROR 1045 (28000): Access denied for user '...'@'...' (using password: YES)

For some usecases, you might need to force using TCP instead of sockets:

mysql -u root -padmin -h localhost --port 3307 --protocol=tcp
During the installation, prestashop cannot connect to mysql - bad charset
Server sent charset (255) unknown to the client. Please, report to the developers

MySQL 8 changed the default charset to utfmb4. But some clients do not know this charset. This requires to modify the mysql configuration file.

If you are using a mysql container, you need to :

  • modify mysql configuration file /etc/mysql/my/cnf and add:
[client]
default-character-set=utf8

[mysql]
default-character-set=utf8


[mysqld]
collation-server = utf8_unicode_ci
character-set-server = utf8
  • restart mysql container

How to use the builder script

For more information, read HOW-TO-USE.md file

Tag summary

Content type

Image

Digest

sha256:7fd7dcb7a

Size

194.7 MB

Last updated

8 months ago

docker pull prestashop/base:8.4-fpm