dev-master
9999999-dev https://github.com/fsspencer/dockerize-magentoDocker bash console to manage Magento 1 and 2 projects
Apache-2.0
Docker bash console to manage Magento 1 and 2 projects
This is a simple bash script that allows you to create a container for a Magento 1 or 2 project with the ability to create/import/maintain an existing project, (*1)
docker
Execute the following command in your terminal in order to execute the installer. You need to have "git" and "curl" installed within your terminal., (*2)
bash <(curl -s -X GET "https://raw.githubusercontent.com/fsspencer/bash-docker-magento/master/dockerize?v='$(date +"%s")'") setup
This will install dockerize in ~/.dockerize/bin and create a symlink on the /usr/local/bin directory, and it will download each needed container for docker., (*3)
That will pull the necessary Docker images., (*4)
composer require fsspencer/dockerize-magento
This will create a dockerize file to your project root directory. You just need to run it:, (*5)
./dockerize install
or, (*6)
bash dockerize install
That will pull the necessary Docker images., (*7)
dockerize <action> <arguments...>
Actions:, (*8)
Command | Description |
---|---|
install | Install Magento and MySQL |
update | Check for updates |
init | Initialize Magento project |
bash | Connect to your docker container |
php | Executes php cli within your project root |
composer | Executes composer within your project root |
grunt | Executes grunt-cli Utility within your project root |
gulp | Executes gulp Utility within your project root |
npm | Executes npm within your project root |
mysql | Executes Connect to the MySQL client server |
n98 | Executes n98-magerun within your project root |
magento | Executes Magento 2 command line tool (e.g: dockerize magento setup:upgrade) |
config:url | Set automatically the Store URL among other things |
db:create | Creates new database |
db:import | Imports a .sql file located in the project root |
db:dump | Generates a database file in the project root compressed using gzip |
start | Start the server and all of its components |
stop | Stop the server |
remove | Removes local dockerize configuration |
setup | Installs dockerize locally on your computer |
self-update | Updates dockerize locally on your computer |
NOTE: All of this commands will work only for your project root directory. That means that if you want to use, for example, gulp on a specify directory within project project (e.g.: skin/frontend/myvendor/mytheme/) it won't work. In that case, you will need to use the "dockerize bash" command and navigate to that directory and use the gulp command from that place., (*9)
dockerize init
create new database
without importing anythingdockerize init
create new database
and import database
when the script asks. This will create your local.xml file, set your store URL and the restdockerize init
Y
when it asks for create database
n
when it asks for import database
Y
when it asks for install magento
and pick the version you want to install. This will do the rest for youdockerize init
create new database
and import database
when the script asks. This will create your env.php file, set your store URL and the restThe dockerize start
command will create a new config file inside ~/.dockerize directory., (*10)
That file will save some configuration parameters after you initialized the project for the first time, in order to prevent to execute the whole process twice., (*11)
Whenever you execute dockerize start
it will stop any magento docker container and initialize a new one with the current project., (*12)
If you want to reset the project dockerize configuration, you need to execute dockerize remove
within your Magento root directory., (*13)
If you are using a Magento 1 project, (*14)
$ docker exec --user www-data -ti magento bash
If you are using a Magento 2 project, (*15)
$ docker exec --user www-data -ti magento2 bash
This will locate you on the /var/www/html
directory, which is your root dir with permissions for www-data:www-data., (*16)
You can perform the following commands, (*17)
$ dockerize mysql -e "your sql query;"
Or just enter to mysql server, (*18)
$ dockerize mysql
If you have a mysql-client installed locally on your computer, you can connect to it using Docker default IP address 0.0.0.0
, (*19)
$ mysql -h 0.0.0.0 -uroot -proot
The dockerize command has the ability to work with npm, grunt and gulp for direct usage on the project root directory. It is ideal for Magento 2 usage, since the Gruntfile.js
and the package.json
resides on the root., (*20)
But if you want to use those commands on a different directory, you need to connect to your container using the bash
command first., (*21)
Scenario:, (*22)
Follow the next steps:, (*23)
$ dockerize bash # once you are on the magento container $ cd skin/frontend/myvendor/mycustomtheme $ npm install # in order to download the dependencies $ gulp # run gulp with any defined task on your gulpfile.js
ERROR 3167 (HY000) at line XX: The 'INFORMATION_SCHEMA.SESSION VARIABLES' feature is disabled; see documentation for 'show_compatibility_56
, (*24)
Solution: Enter to your mysql server $ dockerize mysql
, and execute the following query set @@global.show_compatibility_56=ON;
. Then try to perform your action again and the error should be gone., (*25)
Docker bash console to manage Magento 1 and 2 projects
Apache-2.0