Docker cli 在unbuntu下没有命令行补全功能

Docker cli 在unbuntu下没有命令行补全功能

起因

使用了docker swift 镜像

1
docker pull swift

问题原因:使用了精简版ubuntu

解决方法

方式一 (建议)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# step 1
apt install bash-completion -y
# lrwxrwxrwx 1 root root 4 Jun 8 01:24 /bin/sh -> bash
ls -l /bin/sh

# step 2

##
#debconf: unable to initialize frontend: Dialog
#debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
#debconf: falling back to frontend: Readline
#Configuring dash
# ----------------

#The system shell is the default command interpreter for shell scripts.

#Using dash as the system shell will improve the system's overall performance.
# It does not alter the shell presented to interactive users.

# Use dash as the default system shell (/bin/sh)? [yes/no]
## 选择 no

dpkg-reconfigure dash

# step 3

chmod +x /usr/share/bash-completion/bash_completion
/usr/share/bash-completion/bash_completion


方式二

1
2
3
4
apt  remove vim-common
apt autoremove
apt install vim -y

方式三 (不建议)

直接使用 *bash* , 不建议 会出现一些不必要的权限问题

1
2
3
4
5
6
# bash  --version
# GNU bash, version 4.4.20(1)-release (x86_64-pc-linux-gnu)

sh-4.4# bash
root@22a56bf7248b:/#