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

Python 将Docker存储库添加到APT源时出现错误,python,docker,ubuntu,ansible,ubuntu-16.04,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 其中,

我正在尝试使用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_详细信息定义为:

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",

dockerproject.org APT和YUM repos已关闭:

注意:关闭dockerproject.org APT和百胜回购2020-03-31 Docker将于2020年3月31日关闭托管在“dockerproject.org”和“dockerproject.com”上的弃用APT和YUM存储库

我们注意到该项目引用了其中一个存储库,建议更新以使用“download.docker.com”存储库来防止中断

更多信息:


--

您是否已为存储库添加apt密钥?是@AKX,apt密钥已添加到此任务之前。以下是ansible任务:
-name:Add-official-Docker-repository-GPG-key-apt\u-key:keyserver:“{Docker\u-apt\u-key\u-url}”id:“{{Docker\u-apt\u-key\u-id}”状态:present-been:true
是否安装了apt transport-https?是的,也安装了apt transport-https。在将Docker Repository添加到APT sources之前执行的所有任务更新了原始问题。答案实际上比我想象的要简单。。。见我的答案。谢谢你的投入,请确认我是否需要更新
debhttps://apt.dockerproject.org/repo ubuntu xenial main
debhttps://download.docker.com/linux/ubuntu xenial stable
安装docker引擎也不起作用:
docker\u软件包:docker engine=17.05.0~ce-0~ ubuntu xenial
请建议是否也需要安装修改?它是
docker-ce
,而不是
docker-engine
。谢谢AKX的帮助!
- 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```