内容简介:jekyll运行依赖ruby,每次重装都会遇到版本问题,挺麻烦,干脆做成镜像docker上有jekyll的官方镜像,如果是直接运行,没什么问题。如果你挂载volume就会有权限问题
说明
jekyll运行依赖ruby,每次重装都会遇到版本问题,挺麻烦,干脆做成镜像
官方镜像存在的问题
docker上有jekyll的官方镜像,如果是直接运行,没什么问题。
如果你挂载volume就会有权限问题
jekyll 3.8.5 | Error: Permission denied @ dir_s_mkdir - /srv/jekyll/_site
制作步骤
步骤1:修改镜像入口文件entrypoint
从官方镜像jekyll中拿到入口文件,做一点修改
#!/bin/bash
[ "$DEBUG" = "true" ] && set -x
set -e
# --
: ${JEKYLL_UID:=$(id -u jekyll)}
: ${JEKYLL_GID:=$(id -g jekyll)}
# --
export JEKYLL_UID
export JEKYLL_GID
# --
# Users can customize our UID's to fit their own so that
# we don't have to chown constantly. Well it's not like
# we do so much of it (anymore) it's slow, but we do
# change permissions which can result in some bad
# behavior on OS X.
# --
if [ "1" != "0" ] ; then # 修改了此处,改目录权限
usermod -u $JEKYLL_UID jekyll
groupmod -g $JEKYLL_GID jekyll
chown_args=""
[ "$FULL_CHOWN" ] && chown_args="-R"
for d in "$JEKYLL_DATA_DIR" "$JEKYLL_VAR_DIR"; do
chown $chown_args jekyll:jekyll "$d"
done
fi
# --
exec "$@"
步骤2:镜像制作脚本,dockerfile文件
FROM jekyll/builder:3.8 COPY --chown=jekyll:jekyll entrypoint /usr/jekyll/bin/entrypoint RUN gem install jekyll-admin redcarpet
步骤3:编译镜像
docker build . -t wyq/blog:0.1
步骤4:启动脚本,docker-compose.yml文件
version: '2'
services:
blog:
image: wyq/blog:0.1
volumes:
- ./blog:/srv/jekyll
ports:
- "4000:4000"
command: jekyll serve -P 4000 -H 0.0.0.0 -w
步骤5:启动
docker-compose -f docker-compose.yml up
来源
http://www.yongqingking.top/docker/2019/04/08/docker-jekyll.html
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Introduction to Computation and Programming Using Python
John V. Guttag / The MIT Press / 2013-7 / USD 25.00
This book introduces students with little or no prior programming experience to the art of computational problem solving using Python and various Python libraries, including PyLab. It provides student......一起来看看 《Introduction to Computation and Programming Using Python》 这本书的介绍吧!
HTML 压缩/解压工具
在线压缩/解压 HTML 代码
HEX CMYK 转换工具
HEX CMYK 互转工具