2

I am trying to run command docker-compose up -d as a build step of Jenkins, in "execute shell". Job fails and gives me following console log:

docker-compose up --build -d Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable. Build step 'Execute shell' marked build as failure Finished: FAILURE`

When I cd into jenkins workspace (/var/lib/jenkins/workspace/app/) and tried to run docker-compose up, at first I could get a normal build. Right now I get error in console: ERROR: Error processing tar file(archive/tar: invalid tar header):. Of course app builds and runs normally in home directory when invoked from console.

Docker is running on host. It is possible to run docker-compose by regular user. I did add jenkins user to docker group. I even tried following some asian tutorial from http://blog.csdn.net/qiyueqinglian/article/details/46559825 that made me change DOCKER_OPTS in default/docker, but after restarting docker service it was not running on port 4243, so I didn't understood translation or it is not working on ubuntu 16.04 (host system).

Jenkins is not running in container, it is casually installed on host, no VM no docker, nothing. I tried removing docker and jenkins completly from host (purge etc) and reinstalling, still the same errors.

Any ideas?

Patryk Wlaź
  • 493
  • 5
  • 11
  • Go here `/var/lib/jenkins/workspace/app/`,and do this: `sudo -u jenkins docker info`. Do you get any error? – Robert Jun 19 '17 at 14:36
  • Hey thanks for response. I got warning `WARNING: Error loading config file:/home/pwlaz/.docker/config.json - stat /home/pwlaz/.docker/config.json: permission denied`, and after this warning there is normal output of docker info (the same bunch of information I can get as myself, pwlaz). So I'm kind of lost, there is some permission denied but in the same time informations are printed – Patryk Wlaź Jun 20 '17 at 06:39
  • That's ok. The permission denied is because of the bad home dir. This will not fail: `sudo -H -u jenkins docker info`. I don't know what could be happening from jenkins app. – Robert Jun 20 '17 at 11:47

1 Answers1

0

Hit this command as a root user and try again

usermod -aG docker jenkins
Ashwani
  • 485
  • 2
  • 9
  • 23