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
| volume="" | |
| err=$(docker volume rm $volume 2>&1) | |
| echo "err: $err" | |
| container_ids=$(echo $err | awk -F'[' '{print $2}' | awk -F']' '{print $1}') | |
| echo "ids: $ids" | |
| IFS=', ' | |
| for container_id in $container_ids; do | |
| echo "delete container: $container_id" |
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
| # read in zsh is different from bash | |
| # https://superuser.com/questions/555874/zsh-read-command-fails-within-bash-function-read1-p-no-coprocess | |
| # in bash, read -p "prompt" var | |
| # but in zsh, read "var?prompt" | |
| function port_forwarding_local() { | |
| echo "port forwarding to remote server" | |
| read "local_host?local_host (default is empty): " | |
| read "local_port?local_port: " | |
| if [[ -z "${local_port}" ]]; then |
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
| #!/bin/bash | |
| set -e | |
| install -m 0755 -d /etc/apt/keyrings | |
| curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | gpg --dearmor > /etc/apt/keyrings/docker.gpg | |
| chmod a+r /etc/apt/keyrings/docker.gpg | |
| echo \ | |
| "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://mirrors.aliyun.com/docker-ce/linux/ubuntu \ | |
| "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ | |
| tee /etc/apt/sources.list.d/docker.list > /dev/null |
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
| docker volume create mysql56-data | |
| docker run \ | |
| -e MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD \ | |
| --privileged=true \ | |
| -d --name mysql56 \ | |
| -v mysql56-data:/var/lib/mysql \ | |
| -p 33061:3306 \ | |
| --ulimit nofile=65536:65536 \ | |
| mysql:5.6 |
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
| docker volume create mysql80-data | |
| docker run \ | |
| -e MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD \ | |
| -d --name mysql8 \ | |
| -v mysql8-data:/var/lib/mysql \ | |
| -p 33060:3306 mysql:8.0 |
OlderNewer