# Docker - jekyll/jekyll Container

**URL:** <https://talk.jekyllrb.com/t/docker-jekyll-jekyll-container/3824>\
**Category:** Uncategorized\
**Created:** [January 21, 2020, 9:08am UTC](https://talk.jekyllrb.com/t/docker-jekyll-jekyll-container/3824 "2020-01-21T09:08:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![steveng](https://avatars.discourse-cdn.com/v4/letter/s/6de8d8/32.png) [@steveng](https://talk.jekyllrb.com/u/steveng)\
**Post date:** [January 21, 2020, 9:08am UTC](https://talk.jekyllrb.com/t/docker-jekyll-jekyll-container/3824/1 "2020-01-21T09:08:36Z")

</div>

Hello, how can i start the Jekyll Container?

[https://hub.docker.com/r/jekyll/jekyll](https://hub.docker.com/r/jekyll/jekyll)

What is the right input?

I have done:

```
docker pull jekyll/jekyll

```

Where can i find the the Dockerfile?

`https://github.com/envygeeks/jekyll-docker/blob/master/README.md`

Can you please help me?

steveng

---

<div class="post-metadata">

**Author:** ![jordila](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/jordila/32/3488_2.png) [@jordila](https://talk.jekyllrb.com/u/jordila)\
**Post date:** [April 4, 2021, 8:21am UTC](https://talk.jekyllrb.com/t/docker-jekyll-jekyll-container/3824/2 "2021-04-04T08:21:08Z")

</div>

Maybe those help … ?

[your 1st Dockerapp](https://docs.docker.com/get-started/02_our_app)

and @MichaelCurrin [recipes](https://michaelcurrin.github.io/code-cookbook/recipes/containers/jekyll.html)

BTW, @MichaelCurrin ,

when using  
export JEKYLL\_VERSION=4.2

as per your recipe seems to fail on my computer

while  
export JEKYLL\_VERSION=3.8

does not on the jekyll build process.

this is due to not available v 4.2 ‘envygeeks-jekyll image’ may i guess ?

Though… docker … serve does show blank page on ( either 0.0.0.0 , locahost or 127.0.0.1) 4000 port on my browser.

What confuses me is that

> jordi@anarres:/\> ls /srv/jekyll  
> ls: cannot access ‘/srv/jekyll’: No such file or directory

dir. seems to empy …no \_site folder ?

yet …

> jordi@anarres:~/Docker/my-blog\> ls \_site/  
> 404.html about assets feed.xml index.html jekyll

isn’t the Docker command supposed to ‘mount’ \_site on /srv/jekyll folder ? what am i missing ?

- log 👆

$ docker run --rm --volume=“$PWD:/srv/jekyll” -it jekyll/jekyll:$JEKYLL\_VERSION jekyll serve --trace  
…

Fetching minima 2.5.1  
Installing minima 2.5.1  
Bundle complete! 6 Gemfile dependencies, 28 gems now installed.  
Bundled gems are installed into `/usr/local/bundle`  
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86\_64-linux-musl]  
Configuration file: /srv/jekyll/\_config.yml  
Source: /srv/jekyll  
Destination: /srv/jekyll/\_site  
Incremental build: disabled. Enable with --incremental  
Generating…  
Jekyll Feed: Generating feed for posts  
done in 0.479 seconds.  
Auto-regeneration: enabled for ‘/srv/jekyll’  
Server address: [http://0.0.0.0:4000/](http://0.0.0.0:4000/)  
Server running… press ctrl-c to stop.

---

<div class="post-metadata">

**Author:** ![MichaelCurrin](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/michaelcurrin/32/2340_2.png) [@MichaelCurrin](https://talk.jekyllrb.com/u/MichaelCurrin)\
**Post date:** [April 4, 2021, 9:48am UTC](https://talk.jekyllrb.com/t/docker-jekyll-jekyll-container/3824/3 "2021-04-04T09:48:31Z")

</div>

@jordila Whoops, thanks. I updated by guide to say `4.2.0` and tested it is valid.

---

<div class="post-metadata">

**Author:** ![MichaelCurrin](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/michaelcurrin/32/2340_2.png) [@MichaelCurrin](https://talk.jekyllrb.com/u/MichaelCurrin)\
**Post date:** [April 4, 2021, 10:03am UTC](https://talk.jekyllrb.com/t/docker-jekyll-jekyll-container/3824/4 "2021-04-04T10:03:34Z")

</div>

@steveng There are two ways to run docker in a container.

Neither requires to run `docker pull ...`, unless you want to explicitly fetch it or get the latest version that is newer than the downloaded version.

## Docker binary way

If you use of Docker is simple enough, you might be fine without using a Dockerfile at all.

So instead of

```auto
jekyll build --trace

```

You can do a drop-in replacement of a Docker command in there.

```nohighlight
docker run --rm \
  --volume="$PWD:/srv/jekyll" \
  -it jekyll/jekyll:4.2.0 \
  jekyll build --trace

```

Of course that command is much longer, so you might want an alias for that, or setup docker-compose or `Makefile`. Plenty of ways to make sure you just type a short command.

As linked by @jordila , you can use my guide to setup a _new_ Jekyll project or build an existing Jekyll project.  
[Jekyll recipes](https://michaelcurrin.github.io/code-cookbook/recipes/containers/jekyll.html#create-new-site)

That handles Ruby setup and `bundle install` for you! So you don’t even need Ruby or Bundler.  
I don’t know if `jekyll/jekyll` includes Node, but `jekyll/builder` does.

[Images](https://michaelcurrin.github.io/code-cookbook/recipes/containers/jekyll.html#images) available.

Then you can change the command passed to the container to be

```diff
... -it jekyll/jekyll:4.2.0 \
- jekyll build
+ npm install

```

---

<div class="post-metadata">

**Author:** ![MichaelCurrin](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/michaelcurrin/32/2340_2.png) [@MichaelCurrin](https://talk.jekyllrb.com/u/MichaelCurrin)\
**Post date:** [April 4, 2021, 10:31am UTC](https://talk.jekyllrb.com/t/docker-jekyll-jekyll-container/3824/5 "2021-04-04T10:31:56Z")

</div>

@steveng

## Dockerfile way

If you want to add some dependencies like Node, Postgres or Python along with Ruby and Jekyll in the `jekyll/jekyll` image, or have some other complex setup steps, then you a Dockerfile.

See [Setup Jekyll with a Dockerfile](https://michaelcurrin.github.io/code-cookbook/recipes/containers/jekyll.html#setup-jekyll-with-a-dockerfile)

- `Dockerfile`

```auto
FROM jekyll/jekyll:4.2.0

CMD ["jekyll", "--help"]
ENTRYPOINT ["/usr/jekyll/bin/entrypoint"]

```

You can add more install packages there. In my guide I cover use of `apk` and `apt-get`.

Usage in the shell:

```nohighlight
docker build --rm -t my_app:latest .
docker run --rm \
  -p 4000:4000 \
  --volume "$PWD:/srv/jekyll" \
  my_app \
  jekyll serve --trace

```

---

<div class="post-metadata">

**Author:** ![jordila](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/jordila/32/3488_2.png) [@jordila](https://talk.jekyllrb.com/u/jordila)\
**Post date:** [April 4, 2021, 1:17pm UTC](https://talk.jekyllrb.com/t/docker-jekyll-jekyll-container/3824/6 "2021-04-04T13:17:52Z")

</div>

> [@jordila](#):
>
> docker run --rm --volume=“$PWD:/srv/jekyll” -it jekyll/jekyll:$JEKYLL\_VERSION jekyll serve --trace

@MichaelCurrin ,while running

```
docker run --name blog --rm --volume="$PWD:/srv/jekyll" -p 4000:4000 -it jekyll/jekyll:$JEKYLL_VERSION jekyll serve --trace

```

i’m now getting …

![image](https://canada1.discourse-cdn.com/flex030/uploads/jekyllrb/original/2X/c/c8260c9c73285da6c2f79bd392c3cc2c29887f71.png)

what am i missing ?

---

<div class="post-metadata">

**Author:** ![MichaelCurrin](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/michaelcurrin/32/2340_2.png) [@MichaelCurrin](https://talk.jekyllrb.com/u/MichaelCurrin)\
**Post date:** [April 4, 2021, 3:11pm UTC](https://talk.jekyllrb.com/t/docker-jekyll-jekyll-container/3824/7 "2021-04-04T15:11:53Z")

</div>

That’s a Jekyll server running with no content.

Stop the server.

Make a page e.g. `index.md`

```auto
---
---
# Hello world

```

Then start the server again.

Or use this to bootstrap a new project.

```auto
docker ... jekyll new .

```

Or clone my template.

> **[MichaelCurrin/jekyll-blog-demo](https://github.com/MichaelCurrin/jekyll-blog-demo)**
>
> Base for a static website blog - built with Jekyll and the default theme

```auto
git clone https://github.com/MichaelCurrin/jekyll-blog-demo.git
cd jekyll-blog-demo

```
