在docker容器中安装certbot时,避免用户与tzdata交互

我想在具有Ubuntu 16.04映像的docker环境中安装certbot

例如:

docker run -it ubuntu:16.04 /bin/bash

当我在容器内时,安装certbot最直接的方法不起作用,因为它需要用户干预:

apt-get update && \
apt-get install -y software-properties-common && \
add-apt-repository -y -u ppa:certbot/certbot && \
apt-get install -y certbot

问题是tzdata,它会在此交互式对话框中停止:

Extracting templates from packages: 100%
Preconfiguring packages ...
Configuring tzdata
------------------

Please select the geographic area in which you live. Subsequent configuration
questions will narrow this down by presenting a list of cities, representing
the time zones in which they are located.

 1. Africa      4. Australia  7. Atlantic  10. Pacific  13. Etc
 2. America     5. Arctic     8. Europe    11. SystemV
 3. Antarctica  6. Asia       9. Indian    12. US
Geographic area: 

奇怪的是,它在我添加ppa之前安装tzdata时有效:

apt-get update && \
apt-get install -y tzdata && \
apt-get install -y software-properties-common && \
add-apt-repository -y -u ppa:certbot/certbot && \
apt-get install -y certbot

问题:强>

  • 为什么我在添加ppa之前或之后安装tzdata会有所不同?
  • 安装certbot时是否有更好的方法来避免交互式对话框?

作者:,Philipp Claßen

最佳答案

要在没有交互式对话的情况下运行dpkg(在Apt之类的其他工具之后),您可以将一个环境变量设置为

DEBIAN_FRONTEND=noninteractive

作者:David Foerster,Aditya

参考:http://www.kbase101.com/question/5932.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值