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 CLI and Composer CLI, but how can we access the containers? That is where the connect command comes in handy!

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

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

  • mariadb

  • nginx

  • ssl-terminator (nginx)

  • redis

  • elasticsearch

  • php

  • varnish

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