I’m trying to copy my own /etc/resolv.conf inside an Execution Environment but it is always overwritten somehow.
How can we prevent that from happening?
No matter in which section I put RUN chmod 444 /etc/resolv.conf, it always fails with the same eroor message Read-only file system;
Running ansible-builder build -vvv --container-runtime=docker --context="/ee/context" --file="/ee/files/definition/file.yml" --tag="tag:version" -v3 with this definition file:
version: 3
dependencies:
ansible_core:
# Require minimum of 2.15 to get ansible-inventory --limit option
package_pip: ansible-core<2.19
ansible_runner:
package_pip: ansible-runner
galaxy:
collections:
- name: ansible.mysql
...
python_interpreter:
package_system: python311
python_path: /usr/bin/python3.11
python:
- wheel
...
additional_build_steps:
append_base:
- RUN $PYCMD -m pip install -U pip
- RUN dnf -y install dnf-plugins-core
- RUN dnf -y install epel-release epel-next-release
- RUN dnf -y config-manager --set-enabled crb
- RUN mkdir -p /etc/ansible
append_final:
- COPY --from=quay.io/ansible/receptor:devel /usr/bin/receptor /usr/bin/receptor
- RUN mkdir -p /var/run/receptor
- RUN git lfs install --system
- RUN alternatives --install /usr/bin/python python /usr/bin/python3.11 311
- COPY ./etc/ansible/ansible.cfg /etc/ansible/
- COPY ./etc/resolv.conf /etc/
- COPY ./root/.gitconfig /root/
- RUN chmod 644 /etc/ansible/ansible.cfg
- RUN chmod 444 /etc/resolv.conf
- RUN chmod 600 /root/.gitconfig
I get:
...
#47 [final 17/19] RUN chmod 444 /etc/resolv.conf
#47 0.164 chmod: changing permissions of '/etc/resolv.conf': Read-only file system
#47 ERROR: process "/bin/sh -c chmod 444 /etc/resolv.conf" did not complete successfully: exit code: 1