Copy the .env.example
to .env
and edit it for the environment:
COMPOSE_PROJECT_NAME
- The project name. This value will be appended to all of the container and volume names for the deployment.COMPOSE_FILE
- A colon-delimited list ofyml
files to be used for the deployment. For example, if this value were set tofile1.yml:file2.yml
, it will be like invokingdocker-compose -f file1.yml -f file2.yml
.IMAGE_NS
- The prefix for the image namesHTTPD_PORT_80
- The host port for the httpd container's port 80HTTPD_PORT_443
- The host port for the httpd container's port 443DB_PORT
- The host and container port for the mysql containerSERVER_NAME
- The website's servernameMAGENTO_VOLUME
- Either an absolute path for a bind-mounted volume or the name of a docker volumePHP_PORT
- The host and container port that php-fpm will listen onDEPLOY_USER
- The user that the web app commands will run underWORKDIR
- The root directory of the web application
Copy the .yml.example
to a .yml
, edit it for the environment and then add it to the deployment by editing
This is the web server that the site will be running from. Just be sure to create a httpd/ssl/ssl-cert-snakeoil.pem
file that contains the SSL private key followed by the cert data.
The magento site will be either bind-mounted to this container or deployed via script into a docker volume.
Add .ini
files to the php/ini
folder to have them copied to the php container.
The database container. You can create a mysql/conf.d/my.cnf
file to change settings, such as running the DB on a different port:
[client]
port = 3309
[mysqld]
port = 3309
Once everything is ready simply run
docker-compose up -d
Then go into the php container and run:
chmod +x bin/magento
bin/magento setup:install \
--base-url=https://magento.local \
--base-url-secure=https://magento.local \
--db-host=magento_db:3309 \
--db-name=magento \
--db-user=magento \
--db-password=magento \
--backend-frontname=admin \
--admin-firstname=Spencer \
--admin-lastname=Williams \
--admin-email=admin@example.com \
--admin-user=admin \
--admin-password=admin123 \
--language=en_US \
--currency=USD \
--timezone=America/Chicago \
--use-rewrites=1 \
--use-secure=1 \
--use-secure-admin=1
start.sh
Replace the above arguments with values that are appropriate for the environment.
If a change is made to a a build context, you can rebuild the image with:
docker-compose build [service_name]