Execute commands in Docker containers

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

Executes command in a chosen container.

This command is basically a wrapper on top of docker exec 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 status 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:

  • mysql

  • nginx

  • redis

  • elasticsearch

Usage example

Last updated