首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Python容器中安装看守人员时出错

在Python容器中安装看守人员时出错
EN

Stack Overflow用户
提问于 2021-03-07 05:58:02
回答 1查看 555关注 0票数 2

我如何将看守人员安装到我的python码头容器中?我尝试过从源代码安装它,就像文档中描述的那样,但是没有成功。这是我的Dockerfile

代码语言:javascript
复制
FROM python:3.9

# install watchman
RUN git clone https://github.com/facebook/watchman.git -b v4.9.0 --depth 1 && \
  cd watchman && \
  ./autogen.sh && \
  ./configure && \
  make && \
  make install

下面是我试图构建映像时的错误:

代码语言:javascript
复制
$ docker image build --tag pythonwatchman .
...
#5 141.5   CXX      root/watchman-warnerr.o
#5 143.0   CXX      root/watchman-watchlist.o
#5 144.9   CXX      scm/watchman-Mercurial.o
#5 145.6 scm/Mercurial.cpp: In constructor ‘watchman::Mercurial::infoCache::infoCache(std::__cxx11::string)’:
#5 145.6 scm/Mercurial.cpp:16:40: error: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘struct watchman::FileInformation’; use assignment or value-initialization instead [-Werror=class-memaccess]
#5 145.6    memset(&dirstate, 0, sizeof(dirstate));
#5 145.6                                         ^
#5 145.6 In file included from scm/Mercurial.h:10,
#5 145.6                  from scm/Mercurial.cpp:3:
#5 145.6 ./FileInformation.h:18:8: note: ‘struct watchman::FileInformation’ declared here
#5 145.6  struct FileInformation {
#5 145.6         ^~~~~~~~~~~~~~~
#5 146.8 cc1plus: all warnings being treated as errors
#5 146.8 make[1]: *** [Makefile:4446: scm/watchman-Mercurial.o] Error 1
#5 146.8 make[1]: Leaving directory '/watchman'
#5 146.8 make: *** [Makefile:1264: all] Error 2

有办法解决这个问题吗?或者是否有更好的方法在这个容器中安装看门人?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-03-09 06:00:58

或者是否有更好的方法在这个容器中安装看门人?

是的,您可以直接将其预编译的二进制文件安装到容器中,无需从源代码构建,请参阅

接下来是一个完整的解决方案,FYI。

文档:

代码语言:javascript
复制
FROM python:3.9

ARG WM_VERSION=v2021.03.01.00

# install watchman
RUN wget https://github.com/facebook/watchman/releases/download/$WM_VERSION/watchman-$WM_VERSION-linux.zip && \
unzip watchman-$WM_VERSION-linux.zip && \
cd watchman-$WM_VERSION-linux && \
mkdir -p /usr/local/{bin,lib} /usr/local/var/run/watchman && \
cp bin/* /usr/local/bin && \
cp lib/* /usr/local/lib && \
chmod 755 /usr/local/bin/watchman && \
chmod 2777 /usr/local/var/run/watchman && \
cd .. && \
rm -fr watchman-$WM_VERSION-linux.zip watchman-$WM_VERSION-linux

验证:

代码语言:javascript
复制
$ docker build -t abc:1 .
$ docker run --rm -it abc:1 watchman --version
20210222.215625.0

您可以看到我们现在已经可以运行watchman command了。

顺便说一下,所有预定义的二进制文件都可以在github中找到。

票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66513668

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档