Hasura CLI: hasura platform:microservice exec

Execute a command in a microservice container


Execute a given command inside a running container for a microservice

hasura platform:microservice exec MICROSERVICE-NAME [-n NAMESPACE] [--container CONTAINER] -- COMMAND [args...] [flags]


# Get output from running 'date' inside microservice 'app'
$ hasura microservice exec app -- date

# Connect to 'app' microservice container through an interactive shell (sh)
$ hasura microservice exec -it app -- sh   # note that sh binary need to be present in terminal

# Execute any command (say 'cat /app/index.html') inside the container for microservice 'app'
$ hasura microservice exec app -- cat /app/index.html

# Do not surround your command and its flags/arguments with quotes
# unless that is how you would execute it normally (i.e., do ls -t /usr, not "ls -t /usr").

# If there are multiple replicas running for the microservice, user --pod=PODNAME flag
$ hasura microservice exec -it app --pod app-1074213085-0spqb -- sh

# add flag --namespace=hasura for Hasura microservices

# NOTE: exec does not work in TTY mode on Git Bash. Please use Windows CMD instead
# ref: https://github.com/docker/toolbox/issues/624


-c, --cluster string     cluster alias to connect
    --container string   container name. If omitted, the first container in the pod will be chosen (use only if you know what this means)
-h, --help               help for exec
-n, --namespace string   namespace of the microservice (user: Custom microservices, hasura: Hasura microservices) (default "user")
-p, --pod string         pod name
-i, --stdin              pass stdin to the container (default true)
-t, --tty                stdin is a TTY (default true)

Options inherited from parent commands

--project string   hasura project directory where the commands should be executed. (default: current directory)


Auto generated by spf13/cobra