3
votes

Directory structure:

  • docker-compuse.yml
  • /faq/.... all the site

In root directory I run docker-compose up --build and I get output that site is running:

faq-site_1  | Configuration file: /srv/faq/_config.yml
faq-site_1  |             Source: /srv/faq
faq-site_1  |        Destination: /srv/faq/_site
faq-site_1  |  Incremental build: disabled. Enable with --incremental
faq-site_1  |       Generating... 
faq-site_1  |                     done in 1.37 seconds.
faq-site_1  |  Auto-regeneration: enabled for '/srv/faq'
faq-site_1  | LiveReload address: http://127.0.0.1:35729
faq-site_1  |     Server address: http://127.0.0.1:4000/faq/
faq-site_1  |   Server running... press ctrl-c to stop.

I SSH'ed to the container with docker exec -it c94ad3af91c9 bash and executed curl localhost:4000. Got expected result of HTML.

I try to run the site on http://127.0.0.1:4000 from the host machine and Chrome fails with "ERR_EMPTY_RESPONSE".

I have configured jekyll to run on a subdirectory of /faq. Tried accessing

nothing works. I always get this from chrome:

enter image description here

Dockerfile:

FROM ubuntu:16.04

RUN apt-get update
RUN apt-get install -y --no-install-recommends apt-utils
RUN apt-get install -y ruby ruby-dev build-essential
RUN gem install jekyll bundler
RUN gem install jekyll-feed
RUN gem install jekyll-paginate
RUN gem install minima

RUN bundle -v
RUN gem -v
RUN jekyll -v

COPY ./ /srv/faq
WORKDIR /srv/faq
CMD ["bundle", "exec", "jekyll", "serve", "--livereload"]

docker-compose.yml:

version: '3'

services:
  faq-site:
    build: ./faq
    volumes:
      - ./faq:/srv/faq
    ports:
      - "4000:4000"
      - "35729:35729"
1

1 Answers

10
votes

Try to bind against 0.0.0.0. Then your site is reachable from an external ip.

CMD ["bundle", "exec", "jekyll", "serve", "--livereload", "--host", "0.0.0.0"]