gpt4 book ai didi

linux - 无法导入 docker 或 docker-py - 没有名为 docker 的模块

转载 作者:行者123 更新时间:2023-12-02 18:20:43 32 4
gpt4 key购买 nike

我已经安装了DockerAnsible到我的 AWS Ec2 Linux 如下:

sudo yum update -y
sudo yum install docker -v
sudo service docker start

sudo yum-config-manager --enable epel
sudo yum repolist
sudo yum install ansible

当我尝试拉动 docker 时,我发现了以下错误消息使用 ansible 将图像上传到我的 AWS Ec2 Linux。
fatal: [127.0.0.1]: FAILED! => {"changed": false, "msg": "Failed to import docker or docker-py - No module named docker. Try `pip install docker` or `pip install docker-py` (Python 2.6)"}

docker 版本
Client:
Version: 18.06.1-ce
API version: 1.38
Go version: go1.10.3
Git commit: e68fc7a215d7133c34aa18e3b72b4a21fd0c6136
Built: Fri Oct 26 23:38:19 2018
OS/Arch: linux/amd64
Experimental: false

Ansible 版本是
ansible 2.6.8
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/home/ec2-user/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.6/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.6.9 (unknown, Nov 2 2017, 19:21:21) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)]

这是我的 ansible playbook 文件的一部分
- name: Pull a container image
docker_container:
name: mynodejs
image: registry.gitlab.com/ppshein/test:latest
pull: yes
state: started
published_ports:
- 8080:80

请让我知道我错过了在 AWS Ec2 Linux 中配置的内容。

最佳答案

对我有用的 ansible 2.9.1 和 Ubuntu 20.10 是安装 python3-docker:

sudo apt-get install python3-docker

关于linux - 无法导入 docker 或 docker-py - 没有名为 docker 的模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53941356/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com