網(wǎng)上很多設(shè)置~/.bashrc
或者/etc/profile
的帖子,但是當我們使用ENTRYPOINT會失效,使用CMD格式的話有導(dǎo)致丟失啟動參數(shù)拳球。
這里"Using an entrypoint script"來實現(xiàn)該功能。
實現(xiàn)alias ll='ls -al'
- 編寫
ll
命令文件:ll
#!/bin/sh
set -e
alias ll="ls -al"
ll "$@"
- Dockerifle文件關(guān)鍵內(nèi)容
...省略...
ADD ./ll /bin/ll
- 運行
docker run -it --rm image:tag ll ~