Je faisais des expériences en Docker et a constaté un comportement étrange.
J'ai pu remplacer la propriété d'un fichier créé avec la commande Root à l'intérieur du Docker avec un autre utilisateur n'ayant pas les permissions Root.
Voici les étapes à suivre pour le reproduire :
$> docker run -dit ubuntu:16.04 bash
$> docker exec -it cont_id bash
$> apt update && apt install -y vim
$> useradd cp -m
$> vim /home/cp/hello.txt
# Write some text and save it
$> su cp
$> cd ~/ && ls -latr;
# Will list hello.txt with user and group as root
$> vim hello.txt
# Write some text and try saving it normally which will fail.
# Try saving it with `:wq!`
Voilà, le fichier est enregistré et l'utilisateur et le groupe auxquels il appartient sont également remplacés par le nouvel utilisateur.
J'ai effectué un enregistrement terminal pour cela et la même chose est affichée. ici .