docker-gitlab icon indicating copy to clipboard operation
docker-gitlab copied to clipboard

bin/cp permission denied when docker run

Open haiyamicode opened this issue 12 years ago • 31 comments

I got this error when trying to run the image, here's the full log:

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 ...
Creating SSH2 ED25519 key; this may take some time ...
invoke-rc.d: policy-rc.d denied execution of restart.
sshd: started
sudo: unable to execute /bin/cp: Permission denied

Version: latest (6.8.2) Host machine: ubuntu 14.04 (with docker.io in the ubuntu repository)

haiyamicode avatar May 15 '14 08:05 haiyamicode

i sense image corruption. I have triggered a rebuild of sameersbn/gitlab:latest on the trusted build service. The build should be ready in a couple of minutes.

If this does not work then please completely delete the following images from the host ubuntu:14.04 sameersbn/ubuntu sameersbn/gitlab ...and then pull the sameersbn/gitlab image from the index.

This issue seems to happen whenever there is a corrupt build or a corrupt intermediate image. I don't think there is any way to tell where the corruption has occurred. The only way I rid myself of this issue is to nuke everything.

sameersbn avatar May 15 '14 08:05 sameersbn

Thanks a lot, I deleted all the images, repulled and the problem is gone now.

haiyamicode avatar May 15 '14 09:05 haiyamicode

I too am having this issue with 6.8.2. No amount of removing the image and repulling seems to solve it.

6.8.0 seems to work just fine though.

repole avatar May 24 '14 01:05 repole

@repole when removing images you should remove all ubuntu 14.04 images, this includes ubuntu:14.04, ubuntu:latest and ubuntu:trusty.

You may also choose to remove all images that may be present in the host if you can.

sameersbn avatar May 24 '14 01:05 sameersbn

So I have a totally clean install of ubuntu and docker. No other images. Should I be pulling these Ubuntu images prior to pulling yours?

It seems that when I get the github repo and manually build from there, the ubuntu images are getting pulled as well, but when I docker pull sameersbn/docker-gitlab:6.8.2, the only image that ends up being built is docker-gitlab, none of the ubuntu stuff.

repole avatar May 24 '14 15:05 repole

the ubuntu and sameersbn/ubuntu images would also be pulled. But thats ok, just a docker pull sameersbn/gitlab:6.8.2 should suffice

sameersbn avatar May 24 '14 15:05 sameersbn

I've done a remove of 6.8.2 five times now and repulled, each time totally clearing my images/containers, and I'm still getting the /bin/cp error.

6.8.1 and 6.8.0 seem to run fine, but when actually browsing to localhost:10080 I just get an nginx page (many hours after having started the container).

Pulling from github and building eventually gets me an error: sudo: unable to execute /bin/mkdir: Permission denied The command [/bin/sh -c /app/setup/install] returned a non-zero code: 1

I'm on Ubuntu 14.04, I'll probably try with Ubuntu 13 in a bit if I can't figure anything out here.

Any logs or things that I can send along that may be of use?

Also thanks for the support and fast responses, really appreciate it.

repole avatar May 24 '14 15:05 repole

@repole the error you mentioned above is in fact the result of image corruption. I would have triggered a rebuild of the 6.8.2 image, but at the moment there is some issue with the docker build service due to which i cannot tag versions on images.

If you are building the image, then remove all the existing images and build from source.

sameersbn avatar May 24 '14 16:05 sameersbn

p.s. you can also try the sameersbn/gitlab:latest, its essentially the 6.9.0 version of gitlab. it hasn't been tagged as 6.9.0 because of the same trusted build issue.

sameersbn avatar May 24 '14 16:05 sameersbn

Latest also gives me the bin/cp issue, have tried it a good five times now with a totally clean install.

Every docker pull or github build I've done has been on a clean docker/ubuntu install, I've always cleared out all images and containers after, so I'm at a bit of a loss.

repole avatar May 24 '14 16:05 repole

@repole i understand your frustration. My final suggestion would be to build from the source. But before you do so, edit the Dockerfile and change the line FROM sameersbn/ubuntu:14.04.20140519 to FROM sameersbn/ubuntu:latest

This will resolve the problem if the issue is coming from the sameersbn/ubuntu:14.04.20140519 image build.

sameersbn avatar May 24 '14 17:05 sameersbn

Gave that a shot, unfortunately same error:

Successfully installed bundler-1.6.2 1 gem installed ---> c38e8ff8324b Step 3 : ADD assets/setup/ /app/setup/ ---> 083da30c087e Step 4 : RUN chmod 755 /app/setup/install ---> Running in ad0b7e950775 ---> e7b9dbb19305 Step 5 : RUN /app/setup/install ---> Running in ed487c6b4133 Adding user git' ... Adding new groupgit' (1000) ... Adding new user git' (1000) with groupgit' ... Creating home directory /home/git' ... Copying files from/etc/skel' ... passwd: password expiry information changed. sudo: unable to execute /bin/mkdir: Permission denied 2014/05/24 10:40:33 The command [/bin/sh -c /app/setup/install] returned a non-zero code: 1

I'll probably try a few more things and keep tinkering, and if no success, I'll try waiting until the next release. Really do appreciate all the help though, regardless of the outcome.

repole avatar May 24 '14 17:05 repole

Just as a quick update, everything seems to be working swimingly with Ubuntu 12.04 as my OS. Suppose it's a compatibility issue with 14.04.

repole avatar May 27 '14 22:05 repole

@repole I am not sure about this. I have installed gitlab on ubuntu 14.04 server as well as desktop editions without any issues.

sameersbn avatar May 28 '14 04:05 sameersbn

Same issue:

Step 5 : RUN /app/setup/install
 ---> Running in 8ca20ac14004
Adding user `git' ...
Adding new group `git' (1000) ...
Adding new user `git' (1000) with group `git' ...
Creating home directory `/home/git' ...
Copying files from `/etc/skel' ...
passwd: password expiry information changed.
sudo: unable to execute /bin/mkdir: Permission denied
2014/05/28 11:18:40 The command [/bin/sh -c /app/setup/install] returned a non-zero code: 1

I'm on 13.04 Building from source Using latest

outrunthewolf avatar May 28 '14 11:05 outrunthewolf

@outrunthewolf have you tried sameersbn/gitlab:latest from the docker index? Just today I updated one of my servers with sameersbn/gitlab:latest from the index with no problems. If you still witness the issue with this version (from the index), then I think it might have something to do with the host.

I am guessing it could be related to selinux, but I cannot be sure. Do you have selinux installed on your ubuntu 13.10 host? As far as I can tell, selinux is not installed by default on ubuntu.

Besides, have you tried deleting all existing images since this issue also appears if an intermediate image suffers some sort of corruption?

This issue is turning out to be a pain!

sameersbn avatar May 28 '14 11:05 sameersbn

@sameersbn ha yeah sorry to compound the problem.

No it doesn't look like selinux is installed

Yes I did use sameersbn/gitlab:latest

And yes I made sure I had a clean image

I have however spun up a droplet with 12.04 running and the install went completely fine.

Do you have an idea of where the issue lies?

outrunthewolf avatar May 28 '14 12:05 outrunthewolf

@outrunthewolf no idea.. just created an account on digital ocean. will check whats going on.

sameersbn avatar May 28 '14 12:05 sameersbn

@outrunthewolf are you using the ubuntu packaged docker.io package or manually installing docker using the official docker ppa?

sameersbn avatar May 28 '14 12:05 sameersbn

@repole @outrunthewolf

I was able to track down the issue in your use case. Basically the stock ubuntu docker.io package seems to cause the issue.

Here's what I did, first I tried with the docker.io package:

apt-get install -y docker.io
docker.io build --tag='sameersbn/gitlab' .

The result of this was

Adding user `git' ...
Adding new group `git' (1000) ...
Adding new user `git' (1000) with group `git' ...
Creating home directory `/home/git' ...
Copying files from `/etc/skel' ...
passwd: password expiry information changed.
sudo: unable to execute /bin/mkdir: Permission denied
2014/05/28 09:06:25 The command [/bin/sh -c /app/setup/install] returned a non-zero code: 1

So I decided to use the latest docker packages straight from http://docs.docker.io/installation/ubuntulinux/#ubuntu-precise-1204-lts-64-bit

apt-get purge docker.io
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
apt-get update
apt-get install lxc-docker

Then purge all existing containers and images and build docker-gitlab

docker rm $(docker ps -a -q)
docker rmi $(docker images -q)
docker build --tag='sameersbn/gitlab' .

And the image builds without any issues.

So it looks like the issue is cause due to the default docker.io ubuntu package. So you know what that means!

sameersbn avatar May 28 '14 13:05 sameersbn