ubuntu 컨테이너 이미지에 ip 명령이 없을 때, apt source를 추가해주고 iproute2를 설치하면 된다.

iproute2 외 nettools 패키지도 네트워크 관련 좋은 도구가 많다.

 

root@71118483fd2e:/# ip -br -c a
bash: ip: command not found
root@71118483fd2e:/# apt install iproute2
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package iproute2
root@71118483fd2e:/# sed -i 's/archive.ubuntu.com/ftp.daum.net/g' /etc/apt/sources.list
root@71118483fd2e:/# apt update && apt -y install iproute2
Get:1 http://mirror.kakao.com/ubuntu focal InRelease [265 kB]
Get:2 http://mirror.kakao.com/ubuntu focal-updates InRelease [114 kB]
Get:3 http://mirror.kakao.com/ubuntu focal-backports InRelease [108 kB]
Get:4 http://mirror.kakao.com/ubuntu focal/universe amd64 Packages [11.3 MB]
Get:5 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:6 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [837 kB]
Get:7 http://mirror.kakao.com/ubuntu focal/multiverse amd64 Packages [177 kB]
Get:8 http://mirror.kakao.com/ubuntu focal/main amd64 Packages [1275 kB]
Get:9 http://mirror.kakao.com/ubuntu focal/restricted amd64 Packages [33.4 kB]
Get:10 http://mirror.kakao.com/ubuntu focal-updates/universe amd64 Packages [1118 kB]
Get:11 http://mirror.kakao.com/ubuntu focal-updates/main amd64 Packages [1844 kB]
Get:12 http://mirror.kakao.com/ubuntu focal-updates/multiverse amd64 Packages [33.7 kB]
Get:13 http://mirror.kakao.com/ubuntu focal-updates/restricted amd64 Packages [899 kB]
Get:14 http://mirror.kakao.com/ubuntu focal-backports/universe amd64 Packages [22.4 kB]
Get:15 http://mirror.kakao.com/ubuntu focal-backports/main amd64 Packages [50.8 kB]
Get:16 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [1417 kB]
Get:17 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [30.1 kB]
Get:18 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [833 kB]
Fetched 20.5 MB in 10s (2000 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
2 packages can be upgraded. Run 'apt list --upgradable' to see them.
Reading package lists... Done
Building dependency tree
Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.30.0 /usr/local/share/perl/5.30.0 /usr/lib/x86_64-linux-gnu/perl5/5.30 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.30 /usr/share/perl/5.30 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype
Setting up iproute2 (5.5.0-1ubuntu1) ...
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
debconf: unable to initialize frontend: Readline
debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.30.0 /usr/local/share/perl/5.30.0 /usr/lib/x86_64-linux-gnu/perl5/5.30 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.30 /usr/share/perl/5.30 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
root@71118483fd2e:/# ip -br -c a
lo               UNKNOWN        127.0.0.1/8
eth0@if8         UP             172.17.0.2/16

+ Recent posts