Skip to content

Docker Local Environment Basic Usage

Alexander Lukyanov edited this page Apr 29, 2022 · 5 revisions

Before You Get Started

  1. Install, run and verify that Docker Local Services working properly.
  2. Have at least one project: Docker Local Environment For A New Project

NOTE: The parameter -u www may be skipped in the commands below where there is a file permission issue.

Install Magento 2 Cron

The following command installs Magento 2 cron to the PHP CLI container crontab:

docker-compose exec -u www cli bin/magento cron:install

Update Settings

When any new changes has been added to docker-compose.yml, .env or global.env file you will need to restart containers. You can run the following commands from the project directory:

docker-compose stop
docker-compose up -d 

Update Container's Images

When you want to update container's images run the following commands from the project directory:

docker-compose stop
docker-compose pull
docker-compose up -d  

Execute A Command In PHP Container

docker-compose exec -u www {command} cli

Example:

docker-compose exec -u www cli bin/magento cron:install

Spin Up a New Container And Access a Terminal

The example for the php cli container:

docker-compose run -u www cli bash
Clone this wiki locally