Create Magento App
Create ScandiPWA AppScandiPWA DocsGitHub
v2
v2
  • Create Magento App
  • Getting started
    • Getting Started
    • Prerequisites
      • Linux requirements
      • MacOS requirements
        • Apple Silicon
      • Windows requirements
    • Available commands
      • Start the application
      • Stop the application
      • Check application status
      • Enter application CLI
      • Explore application logs
      • Execute commands in Docker containers
      • Link a theme
      • Import database dump
      • ⚠️ Uninstall a project
    • Folder structure
    • Updating to New Releases
      • Testing Alpha Releases
    • Configuration File
      • System Configuration File
    • Supported Magento versions
    • How does it work?
    • Limitations
    • What Is New in Version 2
  • Usage guide
    • Using console commands
    • Accessing Docker containers
    • Linking a Scandi Theme
    • Enabling XDebug
    • Enabling SSL
    • Configuring PHP
    • Configuring Multi-Store
    • Configuring NewRelic
    • Access on the local network
    • Using custom domain
    • Using Enterprise Edition
    • Using OpenSearch
    • Importing database
      • Importing remote database
    • Converting legacy Docker setup to CMA
    • Improve Performance
  • Container images
    • PHP Images
      • PHP 8.3
        • PHP 8.3 with Magento 2.4 extensions
        • PHP 8.3 with XDebug
          • PHP 8.3 with XDebug with Magento 2.4 extensions
      • PHP 8.2
        • PHP 8.2 with Magento 2.4 extensions
        • PHP 8.2 with XDebug
          • PHP 8.2 with XDebug with Magento 2.4 extensions
      • PHP 8.1
        • PHP 8.1 with Magento 2.4 extensions
        • PHP 8.1 with XDebug
          • PHP 8.1 with XDebug with Magento 2.4 extensions
      • PHP 7.4
        • PHP 7.4 with Magento 2.4 extensions
        • PHP 7.4 with XDebug
          • PHP 7.4 with XDebug with Magento 2.4 extensions
      • PHP 7.3
        • PHP 7.3 with Magento 2.4 extensions
        • PHP 7.3 with Magento 2.3 extensions
        • PHP 7.3 with XDebug
          • PHP 7.3 with XDebug with Magento 2.4 extensions
          • PHP 7.3 with XDebug with Magento 2.3 extensions
      • PHP 7.2
        • PHP 7.2 with Magento 2.3 extensions
        • PHP 7.2 with XDebug
          • PHP 7.2 with XDebug with Magento 2.3 extensions
    • ElasticSearch Images
      • ElasticSearch 6.8
  • Scripts Extensions
    • PHP Extensions
      • PHP Extensions Package
      • (deprecated) ionCube Extension
  • Troubleshooting
    • Common Issues
    • CMA Debugging
    • Uninstall CMA
Powered by GitBook
On this page
  • yarn run exec <container name> [commands] or npm run exec -- <container name> [commands]
  • Available container names:
  • Usage example

Was this helpful?

  1. Getting started
  2. Available commands

Execute commands in Docker containers

PreviousExplore application logsNextLink a theme

Last updated 9 months ago

Was this helpful?

yarn run exec <container name> [commands] or npm run exec -- <container name> [commands]

Since magento-scripts@1.1.0

Executes command in a chosen container.

This command is basically a wrapper on top of command. It simplifies execution command in docker containers by providing names for docker containers so you don't have to search them by running a command or docker ps.

# Using docker exec

# 1. get container name
docker ps
> ... # docker ps otput

# 2. execute command
docker exec -it <container name> <command>

# Using CMA exec

# 1. execute command
yarn run exec <service name> <command>
> ... # output from command is piped to your terminal

If you don't want to execute specific command, by default exec command will use bash as a command (and redis-cli for redis container) so you will be connected to the container with interactive shell environment.

Available container names:

  • mariadb

  • php

  • varnish

  • nginx

  • ssl-terminator

  • redis

  • elasticsearch or opensearch (depending on your configuration)

Usage example

yarn run exec mariadb

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

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

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

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

# custom command to check for nginx service status in container
yarn run exec nginx service nginx status

# expected output
>[ ok ] nginx is running.
docker exec
status