geerlingguy / ansible-role-docker

Ansible Role - Docker
https://galaxy.ansible.com/geerlingguy/docker/
MIT License
1.8k stars 851 forks source link

Unable to install a specific version of docker on ubuntu #415

Closed thomasbinny closed 9 months ago

thomasbinny commented 1 year ago

Error: "cache_updated": false, "changed": false, "msg": "no available installation candidate for docker-ce=20.10.13"}

I have tried to use the role to install a specific version on ubuntu. It keeps installing the latest version. After the installation when i try to downgrade, it still fails.

the task looks as below

- hosts: masters,workers
  become: yes
  become_method: sudo

  vars:
    pip_install_packages:
      - name: docker
    docker_edition: 'ce'
    docker_packages:
    - "docker-{{ docker_edition }}=20.10.13"
    docker_packages_state: present
    docker_users: [ubuntu]

  roles:
    - geerlingguy.pip
    - geerlingguy.docker

Kindly advise if something is wrong.

thomasbinny commented 1 year ago

I tried my local wierdly i get this error.

ubuntu@k8s-master-1:~$ sudo apt-get install docker-ce=20.10.13
[sudo] password for ubuntu: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package docker-ce is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  docker-ce-cli

my docker list says this.

ubuntu@k8s-master-1:~$ sudo cat /etc/apt/sources.list.d/download_docker_com_linux_ubuntu.list
deb [arch=amd64] https://download.docker.com/linux/ubuntu jammy stable

Any suggestions greatly appreciated.

thomasbinny commented 1 year ago

just tried this on the host machine and it worked manually

ubuntu@k8s-node-1:/etc/apt/sources.list.d$ VERSION_STRING=5:20.10.13~3-0~ubuntu-jammy
ubuntu@k8s-node-1:/etc/apt/sources.list.d$ sudo apt-get install docker-ce=$VERSION_STRING docker-ce-cli=$VERSION_STRING 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  containerd.io docker-ce-rootless-extras docker-scan-plugin libltdl7 libslirp0 pigz slirp4netns
Suggested packages:
  aufs-tools cgroupfs-mount | cgroup-lite
The following NEW packages will be installed:
  containerd.io docker-ce docker-ce-cli docker-ce-rootless-extras docker-scan-plugin libltdl7 libslirp0 pigz slirp4netns
0 upgraded, 9 newly installed, 0 to remove and 85 not upgraded.
Need to get 103 MB of archives.
After this operation, 412 MB of additional disk space will be used.
Do you want to continue? [Y/n] ^C

How should we pass the version to the role?

thomasbinny commented 1 year ago

This has worked finally.

---
- hosts: masters,workers
  become: yes
  become_method: sudo

  vars:
    pip_install_packages:
      - name: docker
    docker_edition: 'ce'
    docker_packages:
      - "docker-{{ docker_edition }}=5:20.10.13~3-0~ubuntu-jammy"
      - "docker-{{ docker_edition }}-cli=5:20.10.13~3-0~ubuntu-jammy"
    docker_users: [ubuntu]

  roles:
    - geerlingguy.pip
    - geerlingguy.docker

Now i have issues to install the same version on the same operating system but on a rapsberry pi. Please suggest

github-actions[bot] commented 11 months ago

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

github-actions[bot] commented 9 months ago

This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.

hrmck commented 3 months ago

This has worked finally.

---
- hosts: masters,workers
  become: yes
  become_method: sudo

  vars:
    pip_install_packages:
      - name: docker
    docker_edition: 'ce'
    docker_packages:
      - "docker-{{ docker_edition }}=5:20.10.13~3-0~ubuntu-jammy"
      - "docker-{{ docker_edition }}-cli=5:20.10.13~3-0~ubuntu-jammy"
    docker_users: [ubuntu]

  roles:
    - geerlingguy.pip
    - geerlingguy.docker

Now i have issues to install the same version on the same operating system but on a rapsberry pi. Please suggest

To anyone who faced this issue in the future, try using apt-cache show docker-ce | grep Version to grab the version names