1

我正在尝试启动并运行dordoka/tomcat docker映像,但运行时出现此错误docker build

Cannot add PPA: 'ppa:~webupd8team/ubuntu/y-ppa-manager'.
ERROR: '~webupd8team' user or team does not exist.
The command '/bin/sh -c apt-get update && 
apt-get install -y software-properties-common &&
add-apt-repository -y ppa:webupd8team/y-ppa-manager &&
add-apt-repository -y ppa:webupd8team/ubuntu/y-ppa-manager &&
apt-get update &&
apt-get install -y git build-essential curl wget software-properties-common'
returned a non-zero code: 1

失败的命令是add-apt-repository -y ppa:webupd8team/ubuntu/y-ppa-manager. 此命令在 docker 之外运行良好。据我所知,代理配置正确。有任何想法吗?

4

1 回答 1

1

@mlowry您必须以root身份运行它有什么特别的原因吗?

我假设当您以用户身份运行它时,您还导出了 http_proxy 吗?

在这种情况下,您可以使用 --build-args 来传递 http_proxy 字符串。

快速示例:

ubuntu@ip-172-31-10-207:~/test$ docker build --build-arg http_proxy=$http_proxy .
Sending build context to Docker daemon  2.048kB
Step 1/4 : FROM alpine:latest
 ---> e21c333399e0
Step 2/4 : ARG http_proxy
 ---> Running in fd0832692097
Removing intermediate container fd0832692097
 ---> 4c58ddefe37c
Step 3/4 : RUN export HTTP_PROXY=$http_proxy
 ---> Running in 913dc802ea8f
Removing intermediate container 913dc802ea8f
 ---> 9c3280343c13
Step 4/4 : RUN env
 ---> Running in 0d078193475a
HOSTNAME=0d078193475a
SHLVL=1
HOME=/root
http_proxy=http://domain\user:pass@proxy.com:8080
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/
Removing intermediate container 0d078193475a
 ---> d4b8996fbb09
Successfully built d4b8996fbb09
于 2018-01-05T15:38:36.793 回答