docker-compose无法建立服务

时间:2020-08-31 13:16:36

标签: docker

我正在使用oatpp Web框架和集成的mongodb模块并克隆example-mongodb演示项目,将oatpp和mongodb与swagger集成在一起,这是一个基本的CRUD应用程序。我试图从我的项目目录中打开的终端运行docker-compose出现如下错误:

$example-mongodb$docker-compose up
Building example-service
Step 1/11 : FROM lganzzzo/alpine-mongocxx:latest
 ---> a39b08adb312
Step 2/11 : ADD src/ /service/src/
 ---> Using cache
 ---> ffeef3ce297b
Step 3/11 : ADD utility/ /service/utility/
 ---> Using cache
 ---> cb8dfbf0a2bf
Step 4/11 : ADD CMakeLists.txt /service/CMakeLists.txt
 ---> Using cache
 ---> 83e98f4a776d
Step 5/11 : WORKDIR /service/utility
 ---> Using cache
 ---> 50ea5d092947
Step 6/11 : RUN ./install-oatpp-modules.sh Release
 ---> Using cache
 ---> 2e6133bd640b
Step 7/11 : WORKDIR /service/build
 ---> Using cache
 ---> 498c1ccea65d
Step 8/11 : RUN cmake ..
 ---> Running in d5b368846760
-- The C compiler identification is GNU 6.4.0
-- The CXX compiler identification is GNU 6.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
-- 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
LIBBSONCXX_INCLUDE_DIRS=
LIBBSONCXX_LIBRARIES=
LIBMONGOCXX_INCLUDE_DIRS=
LIBMONGOCXX_LIBRARIES=
-- Configuring done
CMake Error at CMakeLists.txt:74 (add_executable):
  Cannot find source file:

    test/tests.cpp

  Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
  .hpp .hxx .in .txx

-- Build files have been written to: /service/build
CMake Error at CMakeLists.txt:74 (add_executable):
  No SOURCES given to target: example-mongodb-test

ERROR: Service 'example-service' failed to build: The command '/bin/sh -c cmake ..' returned a non-zero code: 1


我已经在本地系统上安装了docker和docker-compose,并且已经在本地系统上设置了所有依赖项。

1 个答案:

答案 0 :(得分:0)

您在图像中添加了srcutility文件夹,但是没有将test文件夹添加到图像中。通过添加测试文件夹,我想一切都会好的。

ADD test/ /service/test/