AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 1069065
Accepted
Hiddai
Hiddai
Asked: 2021-07-09 15:52:09 +0800 CST2021-07-09 15:52:09 +0800 CST 2021-07-09 15:52:09 +0800 CST

构建 ansible Dockerfile 结果错误找不到 pip3

  • 772
  • 我尝试通过本地 Dockerfile 构建 ansible 的图像:
  • 我从以下 Docker 文件中获得:快速入门:在 Docker 容器中配置 Ansible
FROM centos:7

RUN yum check-update; \
    yum install -y gcc libffi-devel python3 epel-release; \
    yum install -y python3-pip; \
    yum install -y wget; \
    yum clean all

RUN pip3 install --upgrade pip; \
    pip3 install "ansible"; \
    wget -q https://raw.githubusercontent.com/ansible-collections/azure/dev/requirements-azure.txt; \
    pip3 install -r requirements-azure.txt; \
    rm requirements-azure.txt; \
    ansible-galaxy collection install azure.azcollection
    pip3 install "pywinrm>=0.2.2" 

WORKDIR /product

CMD [ "/usr/sbin/init" ]
  • 最后三行是我的补充:pip3 install "pywinrm>=0.2.2", WORKDIR /product,CMD [ "/usr/sbin/init" ]
  • 我通过 VSCODE 运行此 Dockerfile > 右键单击​​ docker-compose 文件并选择Compose Up选项
version: '2'
services:
  ansible:
    container_name: ansible
    hostname: ansible
    image: ansible
    build:
      context: .
      dockerfile: Dockerfile
    volumes: 
      - ../../../../../../../:/product
    dns:
      - 200.0.10.100
  • 我已经成功构建并运行了这个镜像,但最近我创建了新的 git 存储库并将它们克隆到我的主机。在那里,我将这两个文件放在一个文件夹中。
  • 作为构建图像的结果,我收到以下错误:
#6 187.2 ERROR! Neither the collection requirement entry key 'name', nor 'source' point to a concrete resolvable collection artifact. Also 'name' is not an FQCN. A valid collection name must be in the format <namespace>.<collection>. Please make sure that the namespace and the collection name  contain characters from [a-zA-Z0-9_] only.     
#6 187.2
#6 187.2 Could not find pip3.
------
executor failed running [/bin/sh -c yum install -y python3-pip;     pip3 install --upgrade pip;     pip3 install "ansible";     wget -q https://raw.githubusercontent.com/ansible-collections/azure/dev/requirements-azure.txt;     pip3 install -r requirements-azure.txt;     rm requirements-azure.txt;     ansible-galaxy collection install azure.azcollection     pip3 install "pywinrm>=0.2.2"]: exit code: 1
ERROR: Service 'ansible' failed to build : Build failed
The terminal process "C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command docker-compose -f "images\local\ansible\v210\docker-compose.yml" up -d --build" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.
  • 看起来第一个RUN命令根本没有执行
  • 我尝试docker build .了docker-compose up命令 - 无法创建容器
  • 我试图清理我所有的容器、图像和卷并再次构建 - 未能创建容器(我按照本指南:在此处输入链接描述,还使用了 rm 命令)

那么,缺少什么或者我需要修复什么才能使其正常工作?

docker docker-compose
  • 1 1 个回答
  • 396 Views

1 个回答

  • Voted
  1. Best Answer
    Romain
    2021-07-14T12:07:45+08:002021-07-14T12:07:45+08:00

    您的Dockerfile. 命令中的两行没有用orRUN分隔。; \&& \

    ansible-galaxy collection install azure.azcollection; \
    pip3 install "pywinrm>=0.2.2"
    

    因此ansible-galaxy,尝试对pip3.

    • 2

相关问题

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve