phusion / baseimage-docker

A minimal Ubuntu base image modified for Docker-friendliness
http://phusion.github.io/baseimage-docker/
MIT License
8.96k stars 1.09k forks source link

Permission denied errors #46

Closed brynary closed 10 years ago

brynary commented 10 years ago

I'm having some trouble with phusion/baseimage resulting in "Permission denied" errors. Here's an example:

 docker run --rm -it phusion/baseimage:0.9.9 /sbin/my_init -- bash
*** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
No SSH host key available. Generating one...
Creating SSH2 RSA key; this may take some time ...
Creating SSH2 DSA key; this may take some time ...
Creating SSH2 ECDSA key; this may take some time ...
*** Running /etc/rc.local...
*** Booting runit daemon...
*** Runit started as PID 74
*** Running bash...
root@993e4c770d14:/# addgroup --gid 9999 app && adduser --uid 9999 --gid 9999 --disabled-password --gecos "Application" app && usermod -L app
Adding group `app' (GID 9999) ...
Done.
Adding user `app' ...
Adding new user `app' (9999) with group `app' ...
Creating home directory `/home/app' ...
Copying files from `/etc/skel' ...

root@993e4c770d14:/# setuser app touch /tmp/foo
touch: cannot touch `/tmp/foo': Permission denied

root@993e4c770d14:/# setuser app bash -c 'echo foo > /dev/null'
bash: /dev/null: Permission denied

As you can see, after booting a container, a new non-root user is unable to create a file in /tmp or write to /dev/null.

Any ideas? Thanks.

FooBarWidget commented 10 years ago

I cannot reproduce this problem. I'm using the Vagrantfile provided by baseimage-docker:

host$ vagrant up
host$ vagrant ssh
vagrant$ docker run --rm -i -t phusion/baseimage:0.9.9 /sbin/my_init -- bash
# addgroup --gid 9999 app && adduser --uid 9999 --gid 9999 --disabled-password --gecos "Application" app && usermod -L app
# setuser app touch /tmp/foo
=> works
# setuser app bash -c 'echo foo > /dev/null'
=> works too

Maybe you have a filesystem problem on the host. Or maybe it's a Docker bug again.