gitbook fails to run in Docker container: Cannot read unknown type: CharacterDevice
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
Same error with Docker 1.10.1
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)
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!