Products & Services/Docker

[Docker][해결방법] WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

TechNote.kr 2021. 2. 21. 14:45
728x90

Dockerfile 내에서 apt 를 사용하면 "WARNING: apt does not have a stable CLI interface. Use with caution in scripts." 문구가 출력된다.

apt 명령어의 경우 사용자와의 interaction 에 중점을 둔 CLI 이기에 script 내에서 사용하기에 부적절하다는 에러로 apt-get 등의 명령어로 대체하여 사용하면 된다.

apt 명령어별 대체 CLI는 apt의 manpage 에서 확인 가능하다.

update (apt-get(8))
upgrade (apt-get(8))
full-upgrade (apt-get(8))
install, reinstall, remove, purge (apt-get(8))
autoremove (apt-get(8))
satisfy (apt-get(8))
search (apt-cache(8))
show (apt-cache(8))

[에러 발생 상황]

FROM ubuntu:16.04

RUN apt update
RUN apt install -y cron
technote@TechNote:~/docker/example1$ docker image build --no-cache -t example/test:latest .
Sending build context to Docker daemon   5.12kB
Step 1/3 : FROM ubuntu:16.04
 ---> 8185511cd5ad
Step 2/3 : RUN apt update
 ---> Running in dba486734465

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Get:1 http://archive.ubuntu.com/ubuntu xenial InRelease [247 kB]
Get:2 http://security.ubuntu.com/ubuntu xenial-security InRelease [109 kB]
Get:3 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [1928 kB]
Get:4 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
Get:5 http://archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]
Get:6 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages [1558 kB]
Get:7 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages [14.1 kB]
Get:8 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages [9827 kB]
Get:9 http://security.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages [15.9 kB]
Get:10 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [984 kB]
Get:11 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages [8820 B]
Get:12 http://archive.ubuntu.com/ubuntu xenial/multiverse amd64 Packages [176 kB]
Get:13 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [2434 kB]
Get:14 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages [16.4 kB]
Get:15 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [1541 kB]
Get:16 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages [26.2 kB]
Get:17 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages [10.9 kB]
Get:18 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages [12.6 kB]
Fetched 19.1 MB in 5s (3283 kB/s)
Reading package lists...
Building dependency tree...
Reading state information...
All packages are up to date.
Removing intermediate container dba486734465
 ---> 83c1dc63dee6
Step 3/3 : RUN apt install -y cron
 ---> Running in 32f6502dbccc

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
Suggested packages:
  anacron logrotate checksecurity exim4 | postfix | mail-transport-agent
The following NEW packages will be installed:
  cron
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 68.4 kB of archives.
After this operation, 249 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu xenial/main amd64 cron amd64 3.0pl1-128ubuntu2 [68.4 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 68.4 kB in 1s (55.1 kB/s)
Selecting previously unselected package cron.
(Reading database ... 4780 files and directories currently installed.)
Preparing to unpack .../cron_3.0pl1-128ubuntu2_amd64.deb ...
Unpacking cron (3.0pl1-128ubuntu2) ...
Processing triggers for systemd (229-4ubuntu21.29) ...
Setting up cron (3.0pl1-128ubuntu2) ...
Adding group `crontab' (GID 106) ...
Done.
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
update-rc.d: warning: stop runlevel arguments (1) do not match cron Default-Stop values (none)
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of start.
Processing triggers for systemd (229-4ubuntu21.29) ...
Removing intermediate container 32f6502dbccc
 ---> 044f4f53cc11
Successfully built 044f4f53cc11
Successfully tagged example/test:latest

 

 

728x90