如何解决“没有可用的与‘docker-ce’匹配的软件包”

如何解决“没有可用的与‘docker-ce’匹配的软件包”

我正在使用带有 Google Cloud Platform 的 Ubuntu 18.04。我试图通过主机在工作机上安装 docker,但它一直出现相同的错误。

[DEPRECATION WARNING]: Invoking "apt" only once while using a loop via squash_actions is deprecated. Instead of using a loop to supply
multiple items and specifying `name: "{{item}}"`, please use `name: ['apt-transport-https', 'ca-certificates', 'curl', 'software-
properties-common', 'linux-generic-hwe-18.04', 'docker-ce']` and remove the loop. This feature will be removed in version 2.11.

Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
failed: [10.128.0.13] (item=[u'apt-transport-https', u'ca-certificates', u'curl', u'software-properties-common', u'linux-generic-hwe-18.04', u'docker-ce']) => {"ansible_loop_var": "item", "changed": false, "item": ["apt-transport-https", "ca-certificates", "curl", "software-properties-common", "linux-generic-hwe-18.04", "docker-ce"], "msg": "No package matching 'docker-ce' is available"}

我该怎么做才能获取适用于我的 Ansible 剧本的 docker-ce 软件包?

以下是剧本

---
- hosts: Hosts
  become: yes
  become_user: root
  tasks:
  - name: Add Docker GPG key
    apt_key: url=https://download.docker.com/linux/ubuntu/gpg

  - name: Add Docker APT repository
    apt_repository:
      repo: deb [arch=and64] https://download.docker.com/linux/ubuntu {{ansible_distribution_release}} stable

  - name: Install list of packages
    apt:
      name: "{{item}}"
      state: present
      update_cache: yes
    with_items:
      - apt-transport-https
      - ca-certificates
      - curl
      - software-properties-common
      - linux-generic-hwe-18.04
      - docker-ce

相关内容