使用runlike查看docker容器启动命令

背景:使用runlike工具查看容器启动命令

pip install runlike
#安装之后有个警告
WARNING: The script runlike is installed in '/Users/admin/Library/Python/2.7/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

执行runlike centos1出现错误command not found: runlike

zsh: command not found: runlike

解决:
思路:执行脚本一般都在/bin目录下,将/Users/admin/Library/Python/2.7/bin添加到PATH环境变量中即可。

本人环境:mac的zsh终端,而zsh终端会使用~/.bash_profile配置,所以我们将配置加入到.bash_profile文件中即可。

查看zsh的配置信息 cat ~/.zshrc
...
# User configuration
source ~/.bash_profile
...

修改.bash_profile配置文件

#编辑
vim ~/.bash_profile
#添加环境变量
export PATH="/Users/admin/Library/Python/2.7/bin:$PATH"
#执行生效
source ~/.bash_profile

再次执行runlike centos1,OK👌

docker run --name=centos1 --hostname=d09ca1a34d6a --mac-address=02:42:ac:11:00:03 --env=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin --privileged -p 5002:22 --restart=no --label='org.label-schema.name=CentOS Base Image' --label='org.label-schema.license=GPLv2' --label='org.label-schema.vendor=CentOS' --label='org.label-schema.schema-version=1.0' --label='org.label-schema.build-date=20210915' --detach=true -t centos /usr/sbin/init
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值