给常用Docker命令起别名,方便我们访问:
第一步:修改/root/.bashrc文件
vi /root/.bashrc
第二版:添加别名
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias dps='docker ps --format "table {{.ID}}\t{{.Image}}\t{{.Ports}}\t{{.Status}}\t{{.Names}}"'
alias dis='docker images'
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
第三步:执行命令使别名生效
source /root/.bashrc