Command `docker build` is broken
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| | Snappy |
Medium
|
Kick In | ||
| | Snappy Ubuntu Core |
New
|
Undecided
|
Unassigned | |
Bug Description
Firstly, as the shell wrapper for docker currently does `cd /apps/docker/
ubuntu@
FROM errordeveloper/
ADD ./ /app/
EXPOSE 80
ubuntu@
ubuntu@
2015/01/19 08:37:03 no Dockerfile found in ./
Secondly, passing absolute path give "permission denied" error:
docker build -t hello-es-app `pwd`
2015/01/19 08:37:24 Error checking context is accessible: 'can't stat '/home/
| Ilya Dmitrichenko (errordeveloper) wrote : | #1 |
| Ilya Dmitrichenko (errordeveloper) wrote : | #2 |
If chdir is absolutely required, fixing relative path wouldn't be an elegant one... It would be best to avoid chdir.
| Michael Vogt (mvo) wrote : | #3 |
There is a way to fix this on the way in our docker pacakge.
| Changed in snappy-ubuntu: | |
| status: | New → Confirmed |
| importance: | Undecided → Medium |
| assignee: | nobody → Kick In (kick-d) |
| Alexander Sack (asac) wrote : | #4 |
kick-d: any update?
| Kick In (kick-d) wrote : | #5 |
Yes, it is working now with new docker-1.3.3.002 uploaded to the store.
Wanted to update it once docker-1.5.0 is out.
For 'docker build .' to work, you need to be in your $HOME/apps/docker directory, as docker will be restricted from reading/loading files outside this directory by apparmor.
| Changed in snappy-ubuntu: | |
| status: | Confirmed → Fix Released |
| affects: | snappy-ubuntu → snappy |
| Pedro I. Sanchez (pirivan) wrote : | #6 |
Where is the fix?
I just started with snappy and hit this problem. Here is my system:
$ snappy info
release: ubuntu-
architecture: amd64
frameworks: docker, webdm
apps:
$ snappy list
Name Date Version Developer
ubuntu-core 2015-09-17 5 ubuntu
docker 2015-09-17 1.6.2.003 canonical
webdm 2015-09-17 0.9 canonical
generic-amd64 2015-09-17 1.4 canonical
$ cd my-image
$ docker build -t my-image .
FATA[0000] Error checking context is accessible: 'can't stat '.''. Please check permissions and try again.
$ cd ~/apps/docker
$ docker build -t my-image .
FATA[0000] Error checking context is accessible: 'no permission to read from 'Dockerfile''. Please check permissions and try again.
Mr Sanchez - you nearly had it!
On Ubuntu Snappy: I had to copy the dockerfile folder to /home/ubuntu/
Then "cd /home/ubuntu/
Running "docker build -t my-image ." from here works !
| Huygens (huygens-25) wrote : | #8 |
Hi
I think I have a bug which is related.
I've installed Ubuntu Core on a Raspberry Pi 2 and then I have installed Docker using `snap install docker`.
Now I've created a folder under my home directory `mkdir tmux`, and created a Dockerfile under that folder.
Running `sudo docker build -t tmux .` fails:
Error checking context: 'can't stat '/home/
Checking the logs, I see that docker is denied access to the folder by AppArmor.
Where are we suppose to create Dockerfile?
How to solve it?
| Gary.Wang (gary-wzl77) wrote : | #9 |
@Huygens
If you remove sudo in your command line, docker build command will be working for you.
Here is the reason
https:/


Clearly it's caused by the current security policy: localdomain kernel: audit: type=1400 audit(142165666 6.123:11) : apparmor="DENIED" operation="open" profile= "docker_ docker_ 1.3.3.001" name="/ home/ubuntu/ weave-demos- master/ hello-apps/ elasticsearch- js/" pid=4293 comm="docker" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Jan 19 08:37:46 localhost.
I would be less surprised if the policy did not allow to pass `-v $(pwd):/vol` to `docker run`, but that actually works, which is arguably more of security thread then `docker build $(pwd)`...