代码之家  ›  专栏  ›  技术社区  ›  P i

构建Docker镜像在一台机器上成功,但在另一台机器中失败,并显示“无法解析…”`

  •  0
  • P i  · 技术社区  · 4 年前

    我使用以下命令构建Docker镜像:

    docker build -t my-tag:0.0.0 -f Dockerfile-staging .
    

    在我的机器(泰国的MBP)上,它工作正常。 在我同事的机器(Ubuntu,中国)上,它错误为:

    Step 3/9 : RUN apt-get update &&     apt-get upgrade -y &&     apt-get install -y gcc &&     apt-get install -y git &&     apt-get install -y libcurl4 &&     apt-get install -y libpq-dev &&     apt-get install -y libssl-dev &&     apt-get install -y python3-dev &&     apt-get install -y librtmp-dev &&     apt-get install -y libcurl4-gnutls-dev &&     apt-get install -y libcurl4-openssl-dev &&     apt-get install -y postgresql-9.3 &&     apt-get install -y python-psycopg2
     ---> Running in f405a317507e
    Err:1 http://deb.debian.org/debian buster InRelease
      Could not resolve 'debian.map.fastlydns.net' Could not resolve 'deb.debian.org'
    Err:2 http://security.debian.org/debian-security buster/updates InRelease
      Could not resolve 'debian.map.fastlydns.net' Could not resolve 'security.debian.org'
    Err:3 http://deb.debian.org/debian buster-updates InRelease
      Could not resolve 'debian.map.fastlydns.net' Could not resolve 'deb.debian.org'
    Reading package lists...
    W: Failed to fetch http://deb.debian.org/debian/dists/buster/InRelease  Could not resolve 'debian.map.fastlydns.net' Could not resolve 'deb.debian.org'
    W: Failed to fetch http://security.debian.org/debian-security/dists/buster/updates/InRelease  Could not resolve 'debian.map.fastlydns.net' Could not resolve 'security.debian.org'
    W: Failed to fetch http://deb.debian.org/debian/dists/buster-updates/InRelease  Could not resolve 'debian.map.fastlydns.net' Could not resolve 'deb.debian.org'
    W: Some index files failed to download. They have been ignored, or old ones used instead.
    

    为什么会这样?如何修复?

    0 回复  |  直到 4 年前