gitbook icon indicating copy to clipboard operation
gitbook copied to clipboard

gitbook fails to run in Docker container: Cannot read unknown type: CharacterDevice

Open fkoester opened this issue 10 years ago • 3 comments

I am trying to run gitbook build (gitbook version 2.6.7) inside Docker 1.8.2 but it fails reproducable with the following message:

Error: Cannot read unknown type: CharacterDevice The command '/bin/sh -c node_modules/.bin/gitbook build --log debug' returned a non-zero code: 1

I tracked down this message to the following fstream code: https://github.com/npm/fstream/blob/master/lib/reader.js#L254

It does not matter if I use Docker's aufs or devicemapper storage backend or if I execute gitbook at build-time in a RUN command or at runtime in CMD.

My dockerfile:

FROM node:4
MAINTAINER Fabian Köster <[email protected]>

COPY . ./

RUN npm install --silent gitbook-cli http-server

RUN node_modules/.bin/gitbook build --log debug

CMD node_modules/.bin/http-server _book

EXPOSE 4000

fkoester avatar Jan 20 '16 10:01 fkoester

Same error with Docker 1.10.1

fkoester avatar Feb 15 '16 09:02 fkoester

I think your issue is that gitbook is not finding the source to read from.

I would suggest you changing COPY to COPY . /srv/src and adding WORKDIR /srv/src so all your commands are executed there.

(I had the same issue and solved it like that)

ghostbar avatar Feb 18 '16 18:02 ghostbar

You are absolutely right! Thank you so much for your help! I could not believe it but you supposed solution is indeed working! It is also cleaner because the COPY . ./ instruction copys everything to the root folder / which could lead to conflicts with existing directories like /sys or something...

Thanks again!

fkoester avatar Feb 19 '16 07:02 fkoester