当前位置: 首页 > 知识库问答 >
问题:

在Docker中安装Mongo c和c++驱动程序

谭凯
2023-03-14

我正在尝试在Docker容器中安装mongocxx驱动程序,第一步是使用package Manager安装mongo-c驱动程序。我精简的DockerFile:

FROM phusion/baseimage:latest
RUN apt-get install -y libmongoc-1.0-0

完成此步骤后,我应该可以按照以下说明安装cxx驱动程序:https://mongodb.github.io/mongo-cxx-driver/mongocxx-v3/installation/

RUN git clone https://github.com/mongodb/mongo-cxx-driver.git  --branch releases/stable --depth 1
WORKDIR /mongo-cxx-driver/build
RUN cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local ..
RUN make EP_mnmlstc_core
RUN make && make install
Step 17/25 : RUN cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local ..
 ---> Running in ba6033b680bb
-- The CXX compiler identification is GNU 5.4.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The C compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Checking for module 'libbson-1.0>=1.5.0'
--   
CMake Error at /usr/share/cmake-3.5/Modules/FindPkgConfig.cmake:367 (message):
  A required package was not found
Step 17/26 : RUN pkg-config --cflags --libs libmongoc-1.0 libbson-1.0
 ---> Running in 343f3b4feb3b
Package libmongoc-1.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libmongoc-1.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libmongoc-1.0' found
Package libbson-1.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libbson-1.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libbson-1.0' found

有人有过在Docker实例中安装的经验吗?你知道这里出了什么问题吗?

共有1个答案

廉高邈
2023-03-14

下面的工作很好地建立我的docker形象。

FROM ubuntu:16.04
RUN apt-get -y update \
    && apt-get -y upgrade

RUN apt-get install -y \
    openssh-server \
    g++ \
    cmake \
    git 

#installing the mongoc dependencies and driver
RUN apt-get install -y \
    pkg-config \
    libssl-dev \
    libsasl2-dev

RUN cd ~ \
    && wget https://github.com/mongodb/mongo-c-driver/releases/download/1.6.2/mongo-c-driver-1.6.2.tar.gz \
    && tar xzf mongo-c-driver-1.6.2.tar.gz \
    && cd mongo-c-driver-1.6.2 \
    && ./configure --disable-automatic-init-and-cleanup \
    && make \
    && make install \
    && cd ~ \
    && rm mongo-c-driver-1.6.2.tar.gz \
    && rm -rf mongo-c-driver-1.6.2

#installing mongocxx driver - connects c++ to mongo
RUN cd ~ \
    && wget https://github.com/mongodb/mongo-cxx-driver/archive/r3.1.1.tar.gz \
    && tar -xzf r3.1.1.tar.gz \
    && cd mongo-cxx-driver-r3.1.1/build \
    && cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local .. \
    && make EP_mnmlstc_core \
    && make \
    && make install \
    && cd ~ \
    && rm r3.1.1.tar.gz \
    && rm -rf mongo-cxx-driver-r3.1.1
 类似资料:
  • 问题内容: 我使用带有标签的php docker容器作为基础: 我将它与可以在主机上找到的基本图像链接在一起。我创建了一个数据库,并用基本值填充了表。 但是尝试访问我的应用程序,我得到: 因此,我认为php容器缺少通过以下方式安装的组件: 我还在以下位置添加了mysql.ini: 如果我告诉我: 但是,错误仍然存​​在。 此外,在运行时: 我得到: 所以看来mysql扩展甚至没有被激活。 我究竟做

  • 我想安装MongoDB C++驱动程序,所以首先是mongocxx 我遵循以下安装:http://mongocxx.org/mongocxx-v3/installation/但无法通过步骤4 当我在mongo-cxx-driver/build中运行它时 有没有人能帮帮我,我已经困在这里很久了? 我的环境:mongo-c-driver 1.15.1 libmongoC-1.0mongoCxx-3.4

  • 我尝试将Oracle JDBC驱动程序安装到Apache Geronimo,但没有成功。我正在使用ojdbc6。罐子 我将其复制到repository文件夹,并尝试先使用Geronimo的管理控制台设置Oracle XA池,但没有成功。它抱怨OracleDataSource的ClassNotFoundException缺少驱动程序。 然后,我尝试设置一个常规的Jdbc驱动程序(oracle瘦)。我

  • 问题内容: 我很难确定应该如何在我的debian 6.0服务器上为PostgreSQL安装JDBC驱动程序。我已将驱动程序.jar移至以下目录: 然后,教程讨论如何使用此代码: 但是,由于我是PostgreSQL的新手,所以我不知道应该把这行放在哪里,或者这是否正确。 我的问题是,除了将jar文件移动到此位置之外,为了在我的postgreSQL安装上安装JDBC驱动程序,我实际上需要做什么? 编辑

  • 我在eclipse(Mars)中导入了一个项目,在我的pom.xml文件中有以下错误:“Missing artifact com.oracle:ojdbc7:jar:12.1.0.1” 这是代码: 我已经从Oracle下载了ojdbc7.jar,并尝试使用以下命令安装它: mvn安装:install-file-dgroupid=com.oracle-dartifactid=ojdbc7-dvers

  • 我已经从http://dev.MySQL.com/downloads/connector/j/下载了MySQL“mysql-connector-java-gpl-5.1.26.msi”的JDBC驱动程序。但我想不出怎么用。http://dev.mysql.com/doc/refman/5.6/en/connector-j-binary-installation.html上的文档说明它是一个zip文