Docker Red Hat 上的实验版本

Docker experimental version on Red Hat

我在 AWS 云上有一台 Red Hat 机器。我安装了 Ansible 和 Docker(作为社区版的实验版现在无法在 Red Hat 上安装)。现在我正在运行一个简单的命令来检查 Docker 是否有效:

ansible local -m shell -a "docker pull hello-world"

我收到以下错误:

localhost | FAILED | rc=1 >>

Using default tag: latest

Warning: failed to get default registry endpoint from daemon (Cannot connect to the Docker daemon. Is the docker daemon running on this host?). Using system default: https://index.docker.io/v1/Cannot connect to the Docker daemon. Is the docker daemon running on this host?

当我使用

sudo ansible local -m shell -a "docker pull hello-world"
localhost | UNREACHABLE! => {
      "changed": false,
      "msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).\r\n",
      "unreachable": true
}

我已经通过将文件复制到本地主机来测试 Ansible,它工作正常,而 Docker 我遇到了这个问题。 Docker 的实验版本有什么我遗漏的或需要设置的吗?

你不想通过 sudo 运行 ansible 但告诉 ansible 它应该 运行 使用 sudo 的命令。这可以通过添加 -s 标志

来完成
ansible local -s -m shell -a "docker pull hello-world"