Comment 1 for bug 1674505

Revision history for this message
Gary.Wang (gary-wzl77) wrote :

Okay, I found the root cause why docker build and docker compose doesn't work for me now.

Regarding the "Error checking context: 'can't stat "
We have apparmor policy for the read-only home area

owner @{HOME}/snap/@{SNAP_NAME}/ r,
owner @{HOME}/snap/@{SNAP_NAME}/** mrkix,

and read/write home area in @{HOME} if home interface is declared in yaml file and connected

owner @{HOME}/ r,
owner @{HOME}/[^s.] rwk,
owner @{HOME}/s[^n] rwk,
owner @{HOME}/sn[^a] rwk,
owner @{HOME}/sna[^p] rwk,
owner @{HOME}/{s,sn,sna}{,/} rwk,

I'm carrying over habits from snap command with sudo. However when I pre-append "sudo" in docker command it turns out the read/write home area ending up to
/root/
instead of user's $HOME
/home/gary/ (in my case)

That's why I see the "apparmor denies" error when running the following command
cd ~/test_build && sudo docker build -t hello-world .
after removing sudo, image can be generated successfully.

However with docker(docker.io deb package), running sudo docker
works well and image can be created as usual.
That's the difference in the usage of docker between deb package and snap package at this point.