2017-12-29 30 views
1

나는 고정 표시기 상 이미지에 패키지를 설치하기 위해 노력하고있어,하지만 apt-get을 명령이 작동하지 않는 것 같다 ... apt-get을 고정 표시기 컨테이너에서 작동하지 않는 명령을

나는 용기에이를 때 우분투 기반으로 :

Err:1 http://archive.ubuntu.com/ubuntu zesty InRelease 
    Temporary failure resolving 'archive.ubuntu.com' 
Err:2 http://security.ubuntu.com/ubuntu zesty-security InRelease 
    Temporary failure resolving 'security.ubuntu.com' 
Err:3 http://archive.ubuntu.com/ubuntu zesty-updates InRelease 
    Temporary failure resolving 'archive.ubuntu.com' 
Err:4 http://archive.ubuntu.com/ubuntu zesty-backports InRelease 
    Temporary failure resolving 'archive.ubuntu.com' 
Reading package lists... Done 
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/zesty/InRelease Temporary failure resolving 'archive.ubuntu.com' 
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/zesty-updates/InRelease Temporary failure resolving 'archive.ubuntu.com' 
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/zesty-backports/InRelease Temporary failure resolving 'archive.ubuntu.com' 
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/zesty-security/InRelease Temporary failure resolving 'security.ubuntu.com' 
W: Some index files failed to download. They have been ignored, or old ones used instead. 
Reading package lists... Done 
Building dependency tree 
Reading state information... Done 
E: Unable to locate package openssh-server 

나는이

같은 Dockerfile에서이 작업을 수행하려고 : 16.04

apt-get update && apt-get install -y openssh-server 

나는이있어 0

FROM ubuntu:16.04 
RUN apt-get update && apt-get -y install openssh-server 
CMD bin/bash 

및 구축이

sudo docker build -t imagetest . 

와하지만 난이 있어요 :

Sending build context to Docker daemon 2.048kB 
Step 1/3 : FROM ubuntu:16.04 
---> 00fd29ccc6f1 
Step 2/3 : RUN apt-get update && apt-get install openssh-server 
---> Running in ee011c1239d0 
Err:1 http://archive.ubuntu.com/ubuntu xenial InRelease 
    Temporary failure resolving 'archive.ubuntu.com' 
Err:2 http://security.ubuntu.com/ubuntu xenial-security InRelease 
    Temporary failure resolving 'security.ubuntu.com' 
Err:3 http://archive.ubuntu.com/ubuntu xenial-updates InRelease 
    Temporary failure resolving 'archive.ubuntu.com' 
Err:4 http://archive.ubuntu.com/ubuntu xenial-backports InRelease 
    Temporary failure resolving 'archive.ubuntu.com' 
Reading package lists... 
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial/InRelease Temporary failure resolving 'archive.ubuntu.com' 
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-updates/InRelease Temporary failure resolving 'archive.ubuntu.com' 
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-backports/InRelease Temporary failure resolving 'archive.ubuntu.com' 
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/InRelease Temporary failure resolving 'security.ubuntu.com' 
W: Some index files failed to download. They have been ignored, or old ones used instead. 
Reading package lists... 
Building dependency tree... 
Reading state information... 
E: Unable to locate package openssh-server 
The command '/bin/sh -c apt-get update && apt-get install openssh-server' returned a non-zero code: 100 

나는 공식 문서 일부 포럼에서 검색을했지만 답변을 아무도 내가 나에게 도움이 나이를 찾을 수 없습니다. ..

그들 중 일부는 도커 서비스를 다시 시작한다고했지만, 내게는 효과가 없습니다 .. 일부 사람들은 apt-get update -qq을 사용한다고 말했지만 너무 효과가 없습니다.

그래서 저는 직접 물어 보았고 최근 답변을했습니다.

감사합니다.

+1

방화벽 프록시를 사용하고 있습니까? – yamenk

+0

아니요,하지만 NAT 구성이있는 VM에 있습니다. – ecavard

+0

브리지 옵션으로 전환하여 문제가 해결되는지 확인해보십시오. – yamenk

답변

1

apt-get이 VM에서 정상적으로 작동하는 경우 네트워크 호스트 모드를 사용하여 컨테이너를 빌드 할 수 있습니다.

docker build --network=host ... 
+0

감사합니다! 마지막으로 정상적으로 작동합니다. – ecavard

관련 문제