Red Hat上的Docker实验版

时间:2017-09-18 07:21:04

标签: docker build redhat

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

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

我收到以下错误:

  

localhost |失败| rc = 1>>

     

使用默认标签:最新

     

警告:无法从守护程序获取默认注册表端点(无法连接到Docker守护程序。这个主机上是否运行了docker守护程序?)。使用系统默认值:https://index.docker.io/v1/Cannot连接到Docker守护程序。 docker守护程序是否在此主机上运行?

当我使用

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的实验版本设置的东西吗?

1 个答案:

答案 0 :(得分:2)

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

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