mirror of
https://github.com/DictXiong/dotfiles.git
synced 2025-11-03 14:17:48 +08:00
* riot: remove unknown domain warn
* install.sh: --no-ssh -> --no-auth-info
* doll: --restart=unless-stopped
* zshrc: alias cps and mvs
* riot: proxy -> ssh
* zshrc: not alias rm to trash
* (trial) riot devel: separate preset to config dir riot.d
* riot: support extra options and extra -o options
* (experimental) riot config in a single file
* riot config: add nasp remote and null domain
* gitconf: pull.ff = only
* fix ci
* riot: dynamic port forwarding
* riot: only one domain func will be exec
* to-install: update lemonbench
* to-install: alist
* [exp] riot inferred ssh: ping ping6
* sagt: fix nixos
* riot config: domain 42
* ubuntu.sh: DEBIAN_FRONTEND=noninteractive
* zshrc: ping -n
* zshrc: alias ping -n
* riot-config: jumpserver from sir0 to ssh.beardic.cn
* zshrc: alias ping before checking os type
* frigg: support api4.beardic.cn
* fix(install.sh): crontab fails on a new server
* fix(riot-conf): nasp.ob.ac.cn -> nasp.fit
* fix(install.sh): install crontab (exp)
* feat(test.zsh): test crontab
* fix(riot): secure control master
* fix(ci): riot control master
* fix(riot): not mkdir if dry-run
* feat(vimrc): set shiftwidth=4
* feat(ci): sync tmux-yank
* feat(tmux): set-clipboard on and mouse on (experimental)
* feat(zshrc): alias ping6
* build(ci): hub mirror 1.3->1.4
* fix(zshrc): tmux on msys; feat(common): better perf getting os type and linux dist
* fix(common.sh): get_os_type and get_linux_dist
* feat(zshrc): add plugin {magic-enter,per-directory-history,pip,podman,python,rsync,systemd,timer}
* feat(zshrc): journalctl alias
* feat(vimrc): tab=2 for c,cpp,nix,yaml
* build(ci): checkout v3 -> v4
---------
Co-authored-by: xiongdian.me <xiongdian.me@bytedance.com>
26 lines
713 B
Bash
Executable File
26 lines
713 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )
|
|
source "$THIS_DIR/../tools/common.sh"
|
|
|
|
DOCKER_FORMAT="{{.ID}} {{.Repository}}:{{.Tag}}"
|
|
if [[ -z "$1" || "$1" =~ ^(-h|--help)$ ]]; then
|
|
fmt_info "usage: $0 <image> or -[0-9]*"
|
|
exit
|
|
elif [[ "$1" =~ ^-[0-9]*$ ]]; then
|
|
LAST="${1:1}"
|
|
# the last nth image
|
|
IMAGE_META=($($SUDO docker image ls --format "$DOCKER_FORMAT" | head -n ${LAST:-1} | tail -n 1))
|
|
IMAGE=${IMAGE_META[0]}
|
|
else
|
|
IMAGE_META="$1"
|
|
IMAGE="$1"
|
|
fi
|
|
|
|
if [[ -z "$IMAGE" ]]; then
|
|
fmt_fatal "image not found"
|
|
else
|
|
fmt_note "--> ${IMAGE_META[@]}"
|
|
$SUDO docker run ${2:+"--name"} $2 -itd --restart=unless-stopped $IMAGE sh
|
|
fi
|