python - 将 Docker 存储库添加到 APT 源时出现错误

标签 python docker ubuntu ansible ubuntu-16.04

我正在尝试使用 ansible 脚本将 docker 存储库添加到 ubuntu 16.04 上的 APT 源:

 - name: Add Docker Repository to APT sources
      apt_repository:
          repo: "{{ docker_apt_repository_details }}"
          update_cache: yes
          state: present
      become: true

其中,docker_apt_repository_details 定义为:
docker_apt_repository_details: deb https://apt.dockerproject.org/repo ubuntu-xenial main

但是,观察到以下错误,请注意 ansible 脚本没有更改,并且一个月前运行良好。请建议如何解决这个问题?
module_stdout": "Traceback (most recent call last):\r\n  File \"/tmp/ansible_soFQp0/ansible_module_apt_repository.py\", line 556, in <module>\r\n    main()\r\n  File \"/tmp/ansible_soFQp0/ansible_module_apt_repository.py\", line 544, in main\r\n    cache.update()\r\n  File \"/usr/lib/python2.7/dist-packages/apt/cache.py\", line 522, in update\r\n    raise FetchFailedException(e)\r\napt.cache.FetchFailedException: W:The repository 'https://apt.dockerproject.org/repo ubuntu-xenial Release' does not have a Release file., W:Data from such a repository can't be authenticated and is therefore potentially dangerous to use., W:See apt-secure(8) manpage for repository creation and user configuration details., E:Failed to fetch https://apt.dockerproject.org/repo/dists/ubuntu-xenial/main/binary-amd64/Packages  404  Not Found, E:Some index files failed to download. They have been ignored, or old ones used instead.\r\n", 
21:38:11                "msg": "MODULE FAILURE",

以下是在失败任务之前使用的任务集:
- name: Install Python 2.7.12
     raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)

   - name: Install pip
     apt:
         name: python-pip
         update_cache: yes
         state: latest
     become: true
     become_method: sudo

   - name: Update ubuntu image
     apt:
         update_cache: yes
     become: true

   - name: Ensure APT works with https method
     apt:
         name: "apt-transport-https"
         update_cache: yes
         state: latest
     become: true

   - name: Install CA certificates
     apt:
         name: "ca-certificates"
         update_cache: yes
         state: latest
     become: true

   - name: Add official Docker repository GPG key
     apt_key:
         keyserver: "{{ docker_apt_key_url }}"
         id: "{{ docker_apt_key_id }}"
         state: present
     become: true

   - name: Add Docker Repository to APT sources
     apt_repository:
         repo: "{{ docker_apt_repository_details }}"
         update_cache: yes
         state: present
     become: true```

最佳答案

dockerproject.org APT 和 YUM 存储库已关闭:

Notice: Shutting down dockerproject.org APT and YUM repos 2020-03-31 Docker will be shutting down the deprecated APT and YUM repositories hosted at "dockerproject.org" and "dockerproject.com" on the 31st of March 2020.

We noticed that this project is referencing one of these repositories, and recommend updating to use the "download.docker.com" repository to prevent disruption.

More info: https://www.docker.com/blog/changes-dockerproject-org-apt-yum-repositories/



-- https://apt.dockerproject.org/repo

关于python - 将 Docker 存储库添加到 APT 源时出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61486978/

相关文章:

python - 如果使用不允许的类型调用 add_argument() 是否可能引发错误?

Python ftplib 最佳 block 大小?

docker - 如何在 dockerfile 中使用 bash 配置文件

php - Shell Cron 错误 - 什么可能导致此错误?

python - SQLAlchemy 和 max_allowed_pa​​cket 问题

tomcat - Docker 容器间双向通信

docker - Docker VM时间不是主机OS时间

linux - 用于 Debian Linux 的 nspr-devel?

regex - Ubuntu 16 sed 不能使用括号

python - 如何使用 Kubernetes Python 客户端连接到 Google Kubernetes 引擎