Accessing Docker containers

Since V2 Create Magento App consists of a PHP Docker container that runs Magento and additional containers with Varnish, Redis, Elasticsearch, Nginx, and MariaDB, and CLI to connect all of these things together. We already have a CLI command that gives us access to Magento CLIarrow-up-right and Composer CLIarrow-up-right, but how can we access the containers? That is where the connect command comes in handy!

yarn run exec <service name> # for Yarn
npm run exec <service name> # for NPM

Now we are inside of a chosen container. Here is a list of available service names:

  • mariadb

  • nginx

  • ssl-terminator (nginx)

  • redis

  • elasticsearch

  • php

  • phpWithXdebug

  • varnish

circle-info

If you are using OpenSearch, the service name elasticsearch will remain the same.

Common Usage

yarn run exec mariadb

>root@c8f223c3ea92:/# # inside a mariadb container

# ctrl + d or type 'exit' and press enter

# this is not an alias, but rather service name matching
yarn run exec ma

>root@c8f223c3ea92:/# # inside a mariadb container

Last updated