Where? It is not available in the repository using the image you shared.
Because you try to run only “yum” in the shell and pass the arguments yum to /bin/sh
which doesn’t know anything about that. The error message doesn’t show you what command was actually running because this should have been the actual error message:
ERROR: process '/bin/sh -c "yum -y install ansible.noarch"' did not complete successfully: exit code: 1
These are indeed correct commands, although I don’t see why it would work. Can you show the result of a working version?
By the way you are actualy using an old image. The developers forgot to remove the latest tag and what makes it worse is that they claim in the description that the latest tag is always the most recent image.
https://hub.docker.com/r/rockylinux/rockylinux
Rocky Linux image documentation
The rockylinux/rockylinux:latest
tag is always the most recent version currently available.
which is clarly not true.
https://hub.docker.com/r/rockylinux/rockylinux/tags?page=1&name=latest
At least that version has an ansible package but with a different name
» docker run --rm -it localhost/test bash
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
[root@5705aa3a90a6 /]# yum search ansible
Last metadata expiration check: 0:21:07 ago on Thu Jun 22 20:46:46 2023.
=========================================================================== Name & Summary Matched: ansible ===========================================================================
ansible-collection-microsoft-sql.noarch : The Ansible collection for Microsoft SQL Server management
ansible-collection-redhat-rhel_mgmt.noarch : Ansible Collection of general system management and utility modules and other plugins
ansible-freeipa-tests.noarch : ansible-freeipa tests
ansible-pcp.noarch : Ansible Metric collection for Performance Co-Pilot
ansible-test.x86_64 : Tool for testing ansible plugin and module code
centos-release-ansible-29.noarch : Ansible 2.9 packages from the CentOS ConfigManagement SIG repository
================================================================================ Name Matched: ansible ================================================================================
ansible-core.x86_64 : SSH-based configuration management, deployment, and task execution system
ansible-freeipa.noarch : Roles and playbooks to deploy FreeIPA servers, replicas and clients
You can find these in the list:
centos-release-ansible-29.noarch : Ansible 2.9 packages from the CentOS ConfigManagement SIG repository
ansible-core.x86_64 : SSH-based configuration management, deployment, and task execution system
In case of recent Ansible versions there is a core package and another package usually called “ansible” that contains community developed collections. If you use the latest rockylinux/rockylinux image (not the latest tag but version 9), there is no `centos-release-ansible-*" package at all.
ou don’t need one as you can instal Ansible as I always do, using Python’s package manager, pip.
FROM rockylinux/rockylinux:9
RUN yum install -y aide.x86_64 python3-pip
RUN pip install ansible==8.1.0
docker build . -t localhost/test
» docker run --rm -it localhost/test ansible --version
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
ansible [core 2.15.1]
config file = None
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.9/site-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible
python version = 3.9.16 (main, Dec 8 2022, 00:00:00) [GCC 11.3.1 20221121 (Red Hat 11.3.1-4)] (/usr/bin/python3)
jinja version = 3.1.2
libyaml = True
Or follow instructions like this about using the epel-repo:
There is also an “official” rockylinux Docker image: https://hub.docker.com/_/rockylinux
which doesn’t have latest tag at all.