marcelbirkner / docker-ci-tool-stack

Docker Infrastructure via docker-compose (Jenkins, SonarQube, Nexus, GitLab, Selenium Grid)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ubunut/Mint - Cannot start service jenkins - "rpc error: code = 2"

iamsortiz opened this issue · comments

Problem:

On: docker-compose up

$ docker-compose up
Removing dockercitoolstack_jenkins_1
dockercitoolstack_sonardb_1 is up-to-date
dockercitoolstack_gitlab_1 is up-to-date
dockercitoolstack_seleniumhub_1 is up-to-date
dockercitoolstack_nexus_1 is up-to-date
dockercitoolstack_sonar_1 is up-to-date
dockercitoolstack_nodeff_1 is up-to-date
dockercitoolstack_nodechrome_1 is up-to-date
Recreating e793e66933eb_dockercitoolstack_jenkins_1

ERROR: for jenkins  Cannot start service jenkins: rpc error: code = 2 desc = "oci runtime error: could not synchronise with container process: not a directory"
ERROR: Encountered errors while bringing up the project.

Expected

Running stack

But got

ERROR: for jenkins  Cannot start service jenkins: rpc error: code = 2 desc = "oci runtime error: could not synchronise with container process: not a directory"
ERROR: Encountered errors while bringing up the project.

On system:

$ uname -a
Linux anon 4.4.0-21-generic #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

$ cat /etc/lsb-release 
DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=18
DISTRIB_CODENAME=sarah
DISTRIB_DESCRIPTION="Linux Mint 18 Sarah"

$ cat /etc/os-release 
NAME="Ubuntu"
VERSION="16.04 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
UBUNTU_CODENAME=xenial

$ docker --version
Docker version 1.11.2, build b9f10c9

$ docker info
WARNING: No swap limit support
Containers: 43
 Running: 7
 Paused: 0
 Stopped: 36
Images: 403
Server Version: 1.11.2
Storage Driver: aufs
 Root Dir: /home/anon/.my_services/docker-data/aufs
 Backing Filesystem: extfs
 Dirs: 558
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins: 
 Volume: local
 Network: bridge null host
Kernel Version: 4.4.0-21-generic
Operating System: Ubuntu 16.04 LTS
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 15.58 GiB
Name: mesamint18
ID: 7LUB:OUUS:XBFD:VEB6:EZHE:SMZX:JGML:OJ7N:OLX2:YBHD:DGKA:IZHH
Docker Root Dir: /home/anon/.my_services/docker-data
Debug mode (client): false
Debug mode (server): false
Registry: https://index.docker.io/v1/

With repo at commit:

$ git log --decorate | head -n 5
commit f4f4a0d743c27ec6e69765d4ae920b28bd8df640 (HEAD -> master, origin/master, origin/HEAD)
Author: Marcel Birkner <marcel.birkner@gmail.com>
Date:   Mon Jul 25 08:44:48 2016 +0200

    duplicate volume entry for docker.sock

Cause:

'/usr/local/bin/docker' is a directory on the described system, not the docker binary

$ ls -la /usr/local/bin/docker
total 8
drwxr-xr-x 2 root root 4096 Aug  2 09:27 .
drwxr-xr-x 3 root root 4096 Aug  2 09:27 ..

$ file /usr/local/bin/docker
/usr/local/bin/docker: directory

'/usr/bin/docker' is the docker binary

$ file /usr/bin/docker
/usr/bin/docker: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=774135019a247820eae89976d765ed625aeb940b, not stripped

Solution

On Ubuntu 16.04 (or derived, like Mint 18), subsitute '/usr/local/bin/docker' for '/usr/bin/docker' at docker-compose.yml line 23

21: volumes:
22:   - /var/run/docker.sock:/var/run/docker.sock
23:   - /usr/bin/docker:/usr/bin/docker
24:   - /opt/jenkins/:/var/lib/jenkins/

Example run

$ cat -n docker-compose.yml | tail -n +21 | head -n 5
    21    volumes:
    22      - /var/run/docker.sock:/var/run/docker.sock
    23      - /usr/bin/docker:/usr/bin/docker
    24      - /opt/jenkins/:/var/lib/jenkins/
    25    depends_on:
$ docker-compose up
Removing dockercitoolstack_jenkins_1
dockercitoolstack_sonardb_1 is up-to-date
dockercitoolstack_gitlab_1 is up-to-date
dockercitoolstack_seleniumhub_1 is up-to-date
dockercitoolstack_nexus_1 is up-to-date
dockercitoolstack_sonar_1 is up-to-date
dockercitoolstack_nodeff_1 is up-to-date
dockercitoolstack_nodechrome_1 is up-to-date
Starting e793e66933eb_e793e66933eb_dockercitoolstack_jenkins_1
Attaching to dockercitoolstack_sonardb_1, dockercitoolstack_gitlab_1, dockercitoolstack_seleniumhub_1, dockercitoolstack_nexus_1, dockercitoolstack_sonar_1, dockercitoolstack_nodeff_1, dockercitoolstack_nodechrome_1, e793e66933eb_e793e66933eb_dockercitoolstack_jenkins_1
seleniumhub_1  | starting selenium hub with configuration:

@marcelbirkner I didn't find anything related at the tracker so I created this issue. Please if there's any error or misconception tell me.

If it's right the easiest way to help Ubuntu/Mint users I can think right know it's just adding some sort of disclaimer at README.md

But you can also add a fix script.

This cold be used in automating the fix

sed -i 's/\- \/usr\/local\/bin\/docker:\(\/usr\/bin\/docker\)/- \1:\1/' docker-compose.yml 

Example test:

$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
$ docker-compose up
Starting dockercitoolstack_sonardb_1
Starting dockercitoolstack_gitlab_1
Starting dockercitoolstack_seleniumhub_1
Starting dockercitoolstack_nexus_1
Starting dockercitoolstack_nodeff_1
Starting dockercitoolstack_nodechrome_1
Starting dockercitoolstack_sonar_1
Recreating e793e66933eb_e793e66933eb_e793e66933eb_dockercitoolstack_jenkins_1

ERROR: for jenkins  Cannot start service jenkins: rpc error: code = 2 desc = "oci runtime error: could not synchronise with container process: not a directory"
ERROR: Encountered errors while bringing up the project.
$ sed -i 's/\- \/usr\/local\/bin\/docker:\(\/usr\/bin\/docker\)/- \1:\1/' docker-compose.yml 
$ docker-compose up
Removing dockercitoolstack_jenkins_1
dockercitoolstack_sonardb_1 is up-to-date
dockercitoolstack_gitlab_1 is up-to-date
dockercitoolstack_seleniumhub_1 is up-to-date
dockercitoolstack_nexus_1 is up-to-date
dockercitoolstack_sonar_1 is up-to-date
dockercitoolstack_nodeff_1 is up-to-date
Starting dockercitoolstack_nodechrome_1
Starting e793e66933eb_e793e66933eb_e793e66933eb_e793e66933eb_dockercitoolstack_jenkins_1
Attaching to dockercitoolstack_sonardb_1, dockercitoolstack_gitlab_1, dockercitoolstack_seleniumhub_1, dockercitoolstack_nexus_1, dockercitoolstack_sonar_1, dockercitoolstack_nodeff_1, e793e66933eb_e793e66933eb_e793e66933eb_e793e66933eb_dockercitoolstack_jenkins_1, dockercitoolstack_nodechrome_1

Example fix script

docker-compose.yml.Ubuntu_fix.sh

#!/bin/bash

sed -i 's/\- \/usr\/local\/bin\/docker:\(\/usr\/bin\/docker\)/- \1:\1/' docker-compose.yml

@iamsortiz Got the same error on Ubuntu 14.04, this solution fixed my problem. Thanks.

Hello, we got this same error with a little different wording in a debian 8.0 box. Changing it as suggested fixed the problem. Thanks a lot!