2016-06-15 8 views
0

jekyll 명령을 사용할 수있는 도커 이미지를 생성하고 싶습니다. docker 이미지에 jekyll을 설치하는 방법은 무엇입니까?

나는 다음과 같은 내용으로 Dockerfile 생성 :

ERROR: Error installing jekyll: 
    ERROR: Failed to build gem native extension. 

    current directory: /usr/local/bundle/gems/ffi-1.9.10/ext/ffi_c 
/usr/local/bin/ruby -r ./siteconf20160615-7-12pthrg.rb extconf.rb 
checking for ffi.h... *** extconf.rb failed *** 
Could not create Makefile due to some reason, probably lack of necessary 
libraries and/or headers. Check the mkmf.log file for more details. You may 
need configuration options. 

Provided configuration options: 
    --with-opt-dir 
    --without-opt-dir 
    --with-opt-include 
    --without-opt-include=${opt-dir}/include 
    --with-opt-lib 
    --without-opt-lib=${opt-dir}/lib 
    --with-make-prog 
    --without-make-prog 
    --srcdir=. 
    --curdir 
    --ruby=/usr/local/bin/$(RUBY_BASE_NAME) 
    --with-ffi_c-dir 
    --without-ffi_c-dir 
    --with-ffi_c-include 
    --without-ffi_c-include=${ffi_c-dir}/include 
    --with-ffi_c-lib 
    --without-ffi_c-lib=${ffi_c-dir}/lib 
    --with-libffi-config 
    --without-libffi-config 
    --with-pkg-config 
    --without-pkg-config 
/usr/local/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError) 
You have to install development tools first. 
    from /usr/local/lib/ruby/2.3.0/mkmf.rb:587:in `try_cpp' 
    from /usr/local/lib/ruby/2.3.0/mkmf.rb:1091:in `block in have_header' 
    from /usr/local/lib/ruby/2.3.0/mkmf.rb:942:in `block in checking_for' 
    from /usr/local/lib/ruby/2.3.0/mkmf.rb:350:in `block (2 levels) in postpone' 
    from /usr/local/lib/ruby/2.3.0/mkmf.rb:320:in `open' 
    from /usr/local/lib/ruby/2.3.0/mkmf.rb:350:in `block in postpone' 
    from /usr/local/lib/ruby/2.3.0/mkmf.rb:320:in `open' 
    from /usr/local/lib/ruby/2.3.0/mkmf.rb:346:in `postpone' 
    from /usr/local/lib/ruby/2.3.0/mkmf.rb:941:in `checking_for' 
    from /usr/local/lib/ruby/2.3.0/mkmf.rb:1090:in `have_header' 
    from extconf.rb:16:in `<main>' 

To see why this extension failed to compile, please check the mkmf.log which can be found here: 

    /usr/local/bundle/extensions/x86_64-linux/2.3.0-static/ffi-1.9.10/mkmf.log 

extconf failed, exit code 1 

Gem files will remain installed in /usr/local/bundle/gems/ffi-1.9.10 for inspection. 
Results logged to /usr/local/bundle/extensions/x86_64-linux/2.3.0-static/ffi-1.9.10/gem_make.out 

내가 잘못 뭐하는 거지 :

# https://hub.docker.com/_/ruby/ 
FROM ruby:slim 

RUN gem install jekyll 

는 불행하게도 오류가 발생합니다?

답변

1

문제를 진단하려면 컨테이너로 건너 뛰고 문제의 원인을 파헤 칠 수 있습니다. https://hub.docker.com/u/jekyll/

행운을 빕니다 :

$ docker run -ti --rm ruby:slim /bin/bash 
[email protected]:/# gem install jekyll 
# ... 

은 또한 항상 지킬 고정 표시기 이미지가!

1

Jekyll을 사용하기 전에 DockerFile에 추가해야 할 몇 가지 요구 사항이 있습니다.

  • 루비
  • NodeJS
  • 파이썬 2.7

그래서는 다음과 같아야합니다 당신의 DockerFile : 나는 깨달았다

FROM ruby:2.1 
MAINTAINER [email protected] 

RUN apt-get update \ 
    && apt-get install -y \ 
    node \ 
    python-pygments \ 
    && apt-get clean \ 
    && rm -rf /var/lib/apt/lists/ 

RUN gem install \ 
    github-pages \ 
    jekyll \ 
    jekyll-redirect-from \ 
    kramdown \ 
    rdiscount \ 
    rouge 

VOLUME /src 
EXPOSE 4000 

WORKDIR /src 
ENTRYPOINT ["jekyll"] 
+0

은 루비 패키지는 매우이다 큰. Gravity가 제안한 'jekyll/jekyll'을 사용했습니다. – Edward