【问题标题】:DNS not resolving while deploying docker container in CentOS在 CentOS 中部署 docker 容器时 DNS 无法解析
【发布时间】:2020-06-19 05:55:17
【问题描述】:

尝试在 Cent-OS 中部署 docker 容器时,得到以下结果 错误(DNS 未在容器内解析)

error Command failed.
Exit code: 128
Command: git
Arguments: ls-remote --tags --heads https://github.com/Asymmetrik/node-fhir-server-core.git
Directory: /srv/cpr-fhir
Output:
fatal: unable to access 'https://github.com/Asymmetrik/node-fhir-server-core.git/': Could not resolve host: github.com

**Operating System: CentOS Linux 8 (Core)
Docker version: Version:           19.03.7**

【问题讨论】:

    标签: docker centos centos7 centos8


    【解决方案1】:

    实际上这是因为 docker 容器没有使用本地 DNS。

    修复

    进入docker配置文件/lib/systemd/system/docker.service

    在ExecStart命令中追加dns变量如下

    ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --dns 8.8.8.8

    【讨论】:

      猜你喜欢
      • 2020-08-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-08
      • 1970-01-01
      • 2015-05-29
      • 2015-07-11
      • 2017-02-22
      相关资源
      最近更新 更多