《Docker开发指南》勘误(停更:第9章)

阅读《Docker开发指南》的过程中,发现了一些些错误,有可能是代码格式引起,有可能是翻译过程中引起,都会对阅读和试验产生一定的影响,在这里做一个记录和总结。


勘误1

大约在P63,“说声Hello World”一节中。
FROM python:3.4
RUN pip install Flask==0.10.1 uwsgi==2.0.9
WORKDIR /app
COPY app /app

CMD ["uwsgi", "--http", "0.0.0.0:9090", "--wsgi-file", \
"/app/identidock.py", "--callable", "app", "--stats", \
 "0.0.0.0:9191"]

运行docker build -t identidock .时,出现如下错误

Command "/usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-y59k2wxd/uwsgi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-1l8hghij/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-y59k2wxd/uwsgi/

测试用python:3.4镜像启动命令行docker run -it python:3.4 /bin/bash
运行pip install uwsgi==2.0.8仍然出错,
删除版本号,运行pip install uwsgi(默认为2.0.17.1版本)成功。

因此将Dockerfile中删除uwsgi版本号重新执行,成功。


勘误2

大约在P67-P68,“通过Compose实现自动化”一节中,

通过配置yml文件,使用docker-compose up方式来实现自动化,其中,yml文件配置在代码缩进时出现错误,参照英文原版如下所示(注意空格):

identidock:
 build: .
 ports:
  - "5000:5000"
 environment:
  ENV: DEV
 volumes:
  - ./app:/app

即成功执行。


勘误3

大约在P77,“利用现有镜像”一节中。

对Flask的route增加POST请求的响应,需要修改identicon.py identidock.py,其中body变量,

<input type="text" name="name" value="{}">

会出现ValueError: cannot switch from automatic field numbering to manual field specification的错误,需要将代码改为

<input type="text" name="name" value="{0}">

即可运行成功。


勘误4

大约在P103,更新Dockerfile中。
RUN /usr/local/bin/plugins.sh /usr/share/jenkins</plugins.txt

应改为

RUN /usr/local/bin/plugins.sh /usr/share/jenkins/plugins.txt

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值