docker container에서 apt install bash-completion 적용

OpenJR·2024년 12월 3일

다들 도커 컨테이너에서 bash 자동 완성 기능을 사용하기 위해
1. apt install bash-completion
2. ~/.bashrc을 수정
조금이라도 검색을 해본 사람이라면 위의 내용을 해야하는 것을 알 것이다.

그러나

아무리 백날 탭탭탭 해봐도 apt install <tab>절대 apt로 설치 가능한 패키지가 뜨지 않는데, 그것은 docker의 흉악한 트릭 때문이다.
/etc/apt/apt.conf.d해당 경로에 가보면

jr@jr-MS-7E25:/etc/apt/apt.conf.d$ ls
01-vendor-ubuntu  20auto-upgrades  20packagekit           70debconf                   docker-clean         docker-no-languages
01autoremove      20dbus           50unattended-upgrades  docker-autoremove-suggests  docker-gzip-indexes

docker-clean이 놈이 보일 것인데, 이놈 때문에 탭을 백날 해도 자동 완성이 되지 않는 것이다.

자 이제,

sudo rm으로 저 파일을 삭제 후 apt update를 해보면 이제는 탭을 누르면 우리가 원하는 결과가 나올 것이다.

jr@jr-MS-7E25:/etc/apt/apt.conf.d$ sudo apt install li
Display all 60116 possibilities? (y or n)

출처

https://askubuntu.com/questions/735189/enabling-auto-completion-for-apt-get-install-in-docker-ubuntu-14-04

profile
Jacob

0개의 댓글