-
Bug
-
Resolution: Done
-
Minor
-
DO188 - RHOSCP4.14-en-1-20240307, DO188 - RHOSCP4.12-en-4-20231204
-
None
-
False
-
-
False
-
2
-
ROLE
-
-
-
en-US (English)
-
AppDev Sprint 27-Jun
Please fill in the following information:
URL: | https://role.rhu.redhat.com/rol-rhu/app/courses/do188-4.12/pages/ch02s08 |
Reporter RHNID: | rhn-support-ablum |
Section Title: | GUIDED EXERCISE: Accessing Containers |
Issue description
After Step 4.3 in the GE there is a NOTE that states "you can use the podman exec -ti nginx vim /etc/nginx/nginx.conf command to interactively modify the nginx.conf file with
the vim text editor."
This NOTE is correct only after running the `podman cp`. If you run this as given in the NOTE, the learner will experience the error "Warning: Changing a readonly file" in vim when trying to make an edit.
Steps to reproduce:
[student@workstation ~]$ podman run -d -p 8080:8080 --name nginx registry.ocp4.example.com:8443/redhattraining/podman-nginx-helloworld
36a113a7a80e32ecc3704edb28df7f9702e22454cebf440abb525513409463cd
[student@workstation ~]$ podman exec -ti nginx vim /etc/nginx/nginx.conf
(Go into insert mode in vim)
– INSERT – W10: Warning: Changing a readonly file
Alternatively, reproduce with:
[student@workstation ~]$ podman exec nginx ls -l /etc/nginx/nginx.conf
rw-rr-. 1 root root 2378 Apr 27 2022 /etc/nginx/nginx.conf
[student@workstation ~]$ podman exec nginx /bin/bash -c 'echo "#test" >> /etc/nginx/nginx.conf'
/bin/bash: /etc/nginx/nginx.conf: Permission denied
Workaround:
Either run with `-u root` or run a `podman cp` which will overwrite the ownership to be the default user (uid: 1001).
[student@workstation ~]$ podman exec -u root nginx /bin/bash -c 'echo "#test" >> /etc/nginx/nginx.conf'
[student@workstation ~]$ podman exec nginx tail -1 /etc/nginx/nginx.conf
#test
Another potential fix would be to modify the Containerfile which created this container image which has this in its history:
"created": "2022-04-27T13:20:30.030608287Z",
"created_by": "/bin/sh -c #(nop) ADD file:4b87f6e746c0d47288a18845c68e9f873c2e5f8031f4ef94ffc3b6dc918aa9b9 in /etc/nginx/nginx.conf "
You could then add a chown to be sure its editable by the root groups like was done for other paths:
"created_by": "/bin/sh -c touch /run/nginx.pid && chgrp -R 0 /var/log/nginx /run/nginx.pid && chmod -R g+rwx /var/log/nginx /run/nginx.pid /etc/nginx/nginx.conf"
Expected result:
Fix the NOTE to include the `-u root` option or fix the permissions on /etc/nginx/nginx.conf in the container image.
- is duplicated by
-
PTL-13359 DO188v4.14:ch02s08 : note at step 4.3 says you can use the podman exec -ti nginx vim /etc/nginx/nginx.conf command to interactively modify the nginx.conf file with the vim text editor.
- Closed