zsh - Can 'docker-compose down' be somehow prevented from running in production? -


i don't want possible run docker-compose down in production. ever. there way overwrite command either in zsh or otherwise throw error if run on production server?

we tried alias command else no avail.

i hope you're not doing security purposes? can control user can , cannot manage docker services (and therefore docker-compose) adding/removing them docker group.

if want prevent accidentally running docker down, can write wrapper script:

#!/bin/bash arg in "$@";do     if [[ "$arg" = "down" ]];then         >&2 echo "error: 'docker-compose down' has been disabled!"         exit 1     fi done /usr/local/bin/docker-compose "$@"   # adapt actual path docker-compose binary if different 

put docker-compose in location in $path, e.g. $home/bin/docker-composeand make executable. exit warning stderr if command line contains down.

however, not prevent malicious intents , necessary permissions call real docker-compose binary directly.


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -