Jump to content

Edit History

Paul C

Paul C


Added eternal network

Hi there.

I use docker-compose (which you need to install separate from docker itself) as that allows you to specify the storage volume locations and all the other project info in a single file. I use a local linux machine where I store all my docker instances but it can work on other machine architectures too. In my home directory (/home/paul) I create a subdirectory for a particular project, so for example the directory prestashop_1.7 where I might want to have the latest version to test things out with:

Example docker-compose.yml file in /home/paul/prestashop_1.7:

version: "3"
services:
  presta17:
    image: prestashop/prestashop:latest
    networks:
      ps17:
    ports:
      - 8282:80
    links:
      - mariadb:mariadb
    depends_on:
      - mariadb
    volumes:
      - /home/paul/prestashop_1.7/src:/var/www/html
      - /home/paul/prestashop_1.7/src/modules:/var/www/html/modules
      - /home/paul/prestashop_1.7/src/themes:/var/www/html/themes
      - /home/paul/prestashop_1.7/src/override:/var/www/html/override
    environment:
      - PS_DEV_MODE=1
      - DB_SERVER=mariadb
      - DB_USER=root
      - DB_PASSWD=pickapassword
      - DB_NAME=ps17dev
      - PS_INSTALL_AUTO=0

  mariadb:
    image: mariadb
    networks:
      ps17:
    volumes:
      - /home/paul/prestashop_1.7/db/PrestaShop:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=pickapassword
      - MYSQL_DATABASE=ps17dev

  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    networks:
      ps17:
    links:
      - mariadb:mariadb
    ports:
      - 1236:80
    depends_on:
      - mariadb
    environment:
      - PMA_HOST=mariadb
      - PMA_USER=root
      - PMA_PASSWORD=pickapassword

networks:
  ps17:
    external: true

You then run:

docker-compose up -d

The internal files are exposed via the volume paths on the left in the yml file above, including the database, and they will be created on first run but then persist. For example /home/paul/prestashop_1.7/src will be the root of the prestashop site.

You can easily use your own prestashop environment by just changing the image in the docker-compose.yml file.

Have fun :)

EDIT: It will complain about the external network which you will need to create before bringing it up with:

 

docker network create ps17

You could just use a default network but I also use Nginx Proxy Manager so I can expose the sites externally with a domain name.

Paul C

Paul C

Hi there.

I use docker-compose (which you need to install separate from docker itself) as that allows you to specify the storage volume locations and all the other project info in a single file. I use a local linux machine where I store all my docker instances but it can work on other machine architectures too. In my home directory (/home/paul) I create a subdirectory for a particular project, so for example the directory prestashop_1.7 where I might want to have the latest version to test things out with:

Example docker-compose.yml file in /home/paul/prestashop_1.7:

version: "3"
services:
  presta17:
    image: prestashop/prestashop:latest
    networks:
      ps17:
    ports:
      - 8282:80
    links:
      - mariadb:mariadb
    depends_on:
      - mariadb
    volumes:
      - /home/paul/prestashop_1.7/src:/var/www/html
      - /home/paul/prestashop_1.7/src/modules:/var/www/html/modules
      - /home/paul/prestashop_1.7/src/themes:/var/www/html/themes
      - /home/paul/prestashop_1.7/src/override:/var/www/html/override
    environment:
      - PS_DEV_MODE=1
      - DB_SERVER=mariadb
      - DB_USER=root
      - DB_PASSWD=pickapassword
      - DB_NAME=ps17dev
      - PS_INSTALL_AUTO=0

  mariadb:
    image: mariadb
    networks:
      ps17:
    volumes:
      - /home/paul/prestashop_1.7/db/PrestaShop:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=pickapassword
      - MYSQL_DATABASE=ps17dev

  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    networks:
      ps17:
    links:
      - mariadb:mariadb
    ports:
      - 1236:80
    depends_on:
      - mariadb
    environment:
      - PMA_HOST=mariadb
      - PMA_USER=root
      - PMA_PASSWORD=pickapassword

networks:
  ps17:
    external: true

You then run:

docker-compose up -d

The internal files are exposed via the volume paths on the left in the yml file above, including the database, and they will be created on first run but then persist. For example /home/paul/prestashop_1.7/src will be the root of the prestashop site.

You can easily use your own prestashop environment by just changing the image in the docker-compose.yml file.

Have fun :)

×
×
  • Create New...