Created
February 17, 2026 18:54
-
-
Save alejandro-du/f1e1d410bb14cf548e200bf664061f07 to your computer and use it in GitHub Desktop.
Custom Lazydocker command for running new containers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| customCommands: | |
| images: | |
| - name: "Run New Container" | |
| attach: true | |
| shell: true | |
| command: > | |
| DEFAULT_IMAGE="{{ .Image.Name }}"; | |
| DEFAULT_IMAGE=${DEFAULT_IMAGE:-mariadb}; | |
| read -p "Image (default: $DEFAULT_IMAGE): " CIMAGE; | |
| CIMAGE=${CIMAGE:-$DEFAULT_IMAGE}; | |
| read -p "Container Name (default: $DEFAULT_IMAGE): " CNAME; | |
| CNAME=${CNAME:-$DEFAULT_IMAGE}; | |
| read -p "Extra Options (default: -it, enter 'n' for none): " COPTIONS; | |
| if [ "$COPTIONS" = "n" ]; then COPTIONS=""; else COPTIONS=${COPTIONS:--it}; fi; | |
| read -p "External Port (default: 3306): " CPORT_EXT; | |
| CPORT_EXT=${CPORT_EXT:-3306}; | |
| read -p "Internal Port (default: $CPORT_EXT): " CPORT_INT; | |
| CPORT_INT=${CPORT_INT:-$CPORT_EXT}; | |
| read -p "Env Variables (KEY=VAL, default: MARIADB_ROOT_PASSWORD=pass, enter 'n' for none): " CENV_INPUT; | |
| if [ "$CENV_INPUT" = "n" ]; then CENV=""; else CENV=${CENV_INPUT:-MARIADB_ROOT_PASSWORD=pass}; fi; | |
| if [ -n "$CENV" ]; then ENV_ARGS="-e $CENV"; else ENV_ARGS=""; fi; | |
| docker run -d $COPTIONS --name "$CNAME" -p "$CPORT_EXT":"$CPORT_INT" $ENV_ARGS "$CIMAGE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment