- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我使用clion
和cmake
编写了一个c++应用程序,以编译和运行该项目。从终端或clion运行项目时,该项目运行完美。
我需要构建一个Docker Image来部署该项目,这是我第一次使用Docker。所以我创建了DockerFile
FROM gcc:5.4
# remove cmake
RUN apt-get update \
&& apt-get remove --purge -y \
cmake \
&& apt-get autoremove -y && apt-get autoclean -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# build latest cmake
ARG cmake_sources="https://cmake.org/files/v3.7/cmake-3.7.0.tar.gz"
LABEL cmake-version=3.7.0
RUN cd /opt \
&& mkdir src \
&& curl -s $cmake_sources | tar -xz --strip-components=1 -C src \
&& cd src \
&& ./bootstrap \
&& make -j8 \
&& make install \
&& cd .. \
&& rm -rf src
RUN pwd
WORKDIR /home/mohd/project/MaggotProxyTest
COPY . /home/mohd/project/MaggotProxyTest
RUN apt-get update && apt-get install -y tree
RUN tree -x
RUN pwd
#RUN cmake .
#RUN make
RUN cmake -H. -Bbuild
RUN cmake --build build -- -j3
RUN tree -x
RUN stat /home/mohd/project/MaggotProxyTest/build/CMakeFiles/3.7.0/CompilerIdCXX/a.out
RUN chmod +x /home/mohd/project/MaggotProxyTest/build/CMakeFiles/3.7.0/CompilerIdCXX/a.out
CMD ["./home/mohd/project/MaggotProxyTest/build/CMakeFiles/3.7.0/CompilerIdCXX/a.out"]
sudo docker build -t my_app .
sudo docker build -t app_2 .
Sending build context to Docker daemon 371.2kB
Step 1/17 : FROM gcc:5.4
---> b87db7824271
Step 2/17 : RUN apt-get update && apt-get remove --purge -y cmake && apt-get autoremove -y && apt-get autoclean -y && apt-get clean && rm -rf /var/lib/apt/lists/*
---> Using cache
---> 0c23ca9008a7
Step 3/17 : ARG cmake_sources="https://cmake.org/files/v3.7/cmake-3.7.0.tar.gz"
---> Using cache
---> df7eca2dfdec
Step 4/17 : LABEL cmake-version=3.7.0
---> Using cache
---> 659f8e671fc0
Step 5/17 : RUN cd /opt && mkdir src && curl -s $cmake_sources | tar -xz --strip-components=1 -C src && cd src && ./bootstrap && make -j8 && make install && cd .. && rm -rf src
---> Using cache
---> e9926d53c476
Step 6/17 : RUN pwd
---> Using cache
---> eed6b41de375
Step 7/17 : WORKDIR /home/mohd/project/MaggotProxyTest
---> Using cache
---> f1c50d7563ae
Step 8/17 : COPY . /home/mohd/project/MaggotProxyTest
---> ab3cadd4f213
Step 9/17 : RUN apt-get update && apt-get install -y tree
---> Running in c633632b810f
Get:1 http://security.debian.org jessie/updates InRelease [94.4 kB]
Ign http://deb.debian.org jessie InRelease
Get:2 http://security.debian.org jessie/updates/main amd64 Packages [646 kB]
Get:3 http://deb.debian.org jessie-updates InRelease [145 kB]
Get:4 http://deb.debian.org jessie Release.gpg [2434 B]
Get:5 http://deb.debian.org jessie Release [148 kB]
Get:6 http://deb.debian.org jessie-updates/main amd64 Packages [23.1 kB]
Get:7 http://deb.debian.org jessie/main amd64 Packages [9064 kB]
Fetched 10.1 MB in 17s (578 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
tree
0 upgraded, 1 newly installed, 0 to remove and 88 not upgraded.
Need to get 45.9 kB of archives.
After this operation, 102 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian/ jessie/main tree amd64 1.7.0-3 [45.9 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 45.9 kB in 3s (15.2 kB/s)
Selecting previously unselected package tree.
(Reading database ... 21224 files and directories currently installed.)
Preparing to unpack .../tree_1.7.0-3_amd64.deb ...
Unpacking tree (1.7.0-3) ...
Setting up tree (1.7.0-3) ...
Removing intermediate container c633632b810f
---> b8ee14ee0355
Step 10/17 : RUN tree -x
---> Running in 86327f018039
.
|-- AdvertisementServer.cpp
|-- AdvertisementServer.h
|-- ArrayQueue.h
|-- CMakeLists.txt
|-- Channel.cpp
|-- Channel.h
|-- ControlSession.cpp
|-- ControlSession.h
|-- Defines.h
|-- DeviceQoSManager.cpp
|-- DeviceQoSManager.h
|-- Dockerfile
|-- GlobalChannel.cpp
|-- GlobalChannel.h
|-- MaggotChannel.cpp
|-- MaggotChannel.h
|-- MaggotGarbageCollector.cpp
|-- MaggotGarbageCollector.h
|-- MaggotPacketQueue.cpp
|-- MaggotPacketQueue.h
|-- MaggotScheduler.cpp
|-- MaggotScheduler.h
|-- MaggotSender.cpp
|-- MaggotSender.h
|-- MaggotSession.cpp
|-- MaggotSession.h
|-- MaggotTcpPacket.cpp
|-- MaggotTcpPacket.h
|-- MaggotUdpChannel.cpp
|-- MaggotUdpChannel.h
|-- MainScheduler.cpp
|-- MainScheduler.h
|-- Makefile
|-- MptcpSession.cpp
|-- MptcpSession.h
|-- OutOfOrderQueue.cpp
|-- OutOfOrderQueue.h
|-- Packets.h
|-- Profiler.cpp
|-- Profiler.h
|-- ProxySocket.cpp
|-- ProxySocket.h
|-- RateCapped.h
|-- Receiver.cpp
|-- Receiver.h
|-- Reliable.h
|-- ReorderingQueue.cpp
|-- ReorderingQueue.h
|-- Retransmitter.cpp
|-- Retransmitter.h
|-- Running
|-- Safe_Queue.h
|-- Schedulable.h
|-- Session.cpp
|-- Session.h
|-- SessionKey.cpp
|-- SessionKey.h
|-- SharedLargeBufferPool.cpp
|-- SharedLargeBufferPool.h
|-- SharedPool.h
|-- TODO.txt
|-- TcpScheduler.cpp
|-- TcpScheduler.h
|-- TcpSession.cpp
|-- TcpSession.h
|-- TimerEventManager.cpp
|-- TimerEventManager.h
|-- UdpScheduler.cpp
|-- UdpScheduler.h
|-- UdpSession.cpp
|-- UdpSession.h
|-- Using
|-- Util.cpp
|-- Util.h
|-- VpnManager.cpp
|-- VpnManager.h
|-- b87db7824271
|-- cmake_install.cmake
|-- df7eca2dfdec
|-- e3255b76c200
|-- empty.c
|-- log.txt
|-- log.txt~
|-- rateCap
|-- second-
|-- sniffer.c
`-- socketOpt.c
0 directories, 87 files
Removing intermediate container 86327f018039
---> 906c6fc16d91
Step 11/17 : RUN pwd
---> Running in 1a98be53a294
/home/mohd/project/MaggotProxyTest
Removing intermediate container 1a98be53a294
---> 6929705f2df9
Step 12/17 : RUN cmake -H. -Bbuild
---> Running in b9ed7275783d
-- The C compiler identification is GNU 5.4.0
-- The CXX 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
-- Check for working CXX compiler: /usr/local/bin/c++
-- Check for working CXX compiler: /usr/local/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mohd/project/MaggotProxyTest/build
Removing intermediate container b9ed7275783d
---> 39cf841de150
Step 13/17 : RUN cmake --build build -- -j3
---> Running in 2f0cc83e7dfa
Scanning dependencies of target MaggotProxy
[ 10%] Building CXX object CMakeFiles/MaggotProxy.dir/Util.cpp.o
[ 10%] Building CXX object CMakeFiles/MaggotProxy.dir/ProxySocket.cpp.o
[ 10%] Building CXX object CMakeFiles/MaggotProxy.dir/VpnManager.cpp.o
[ 13%] Building CXX object CMakeFiles/MaggotProxy.dir/UdpSession.cpp.o
[ 16%] Building CXX object CMakeFiles/MaggotProxy.dir/UdpScheduler.cpp.o
[ 20%] Building CXX object CMakeFiles/MaggotProxy.dir/TcpSession.cpp.o
[ 23%] Building CXX object CMakeFiles/MaggotProxy.dir/TcpScheduler.cpp.o
[ 26%] Building CXX object CMakeFiles/MaggotProxy.dir/SessionKey.cpp.o
[ 30%] Building CXX object CMakeFiles/MaggotProxy.dir/Session.cpp.o
[ 33%] Building CXX object CMakeFiles/MaggotProxy.dir/Receiver.cpp.o
[ 36%] Building CXX object CMakeFiles/MaggotProxy.dir/MptcpSession.cpp.o
[ 40%] Building CXX object CMakeFiles/MaggotProxy.dir/MainScheduler.cpp.o
[ 43%] Building CXX object CMakeFiles/MaggotProxy.dir/MaggotSession.cpp.o
[ 46%] Building CXX object CMakeFiles/MaggotProxy.dir/MaggotScheduler.cpp.o
[ 50%] Building CXX object CMakeFiles/MaggotProxy.dir/GlobalChannel.cpp.o
[ 53%] Building CXX object CMakeFiles/MaggotProxy.dir/Channel.cpp.o
[ 56%] Building CXX object CMakeFiles/MaggotProxy.dir/MaggotChannel.cpp.o
[ 60%] Building CXX object CMakeFiles/MaggotProxy.dir/SharedLargeBufferPool.cpp.o
[ 63%] Building CXX object CMakeFiles/MaggotProxy.dir/MaggotTcpPacket.cpp.o
[ 66%] Building CXX object CMakeFiles/MaggotProxy.dir/TimerEventManager.cpp.o
[ 70%] Building CXX object CMakeFiles/MaggotProxy.dir/OutOfOrderQueue.cpp.o
[ 73%] Building CXX object CMakeFiles/MaggotProxy.dir/MaggotPacketQueue.cpp.o
[ 76%] Building CXX object CMakeFiles/MaggotProxy.dir/Retransmitter.cpp.o
[ 80%] Building CXX object CMakeFiles/MaggotProxy.dir/MaggotUdpChannel.cpp.o
[ 83%] Building CXX object CMakeFiles/MaggotProxy.dir/ControlSession.cpp.o
[ 86%] Building CXX object CMakeFiles/MaggotProxy.dir/AdvertisementServer.cpp.o
[ 90%] Building CXX object CMakeFiles/MaggotProxy.dir/MaggotSender.cpp.o
[ 93%] Building CXX object CMakeFiles/MaggotProxy.dir/ReorderingQueue.cpp.o
[ 96%] Building CXX object CMakeFiles/MaggotProxy.dir/MaggotGarbageCollector.cpp.o
[100%] Linking CXX executable MaggotProxy
[100%] Built target MaggotProxy
Removing intermediate container 2f0cc83e7dfa
---> d1bb3504b194
Step 14/17 : RUN tree -x
---> Running in fec09156925b
.
|-- AdvertisementServer.cpp
|-- AdvertisementServer.h
|-- ArrayQueue.h
|-- CMakeLists.txt
|-- Channel.cpp
|-- Channel.h
|-- ControlSession.cpp
|-- ControlSession.h
|-- Defines.h
|-- DeviceQoSManager.cpp
|-- DeviceQoSManager.h
|-- Dockerfile
|-- GlobalChannel.cpp
|-- GlobalChannel.h
|-- MaggotChannel.cpp
|-- MaggotChannel.h
|-- MaggotGarbageCollector.cpp
|-- MaggotGarbageCollector.h
|-- MaggotPacketQueue.cpp
|-- MaggotPacketQueue.h
|-- MaggotScheduler.cpp
|-- MaggotScheduler.h
|-- MaggotSender.cpp
|-- MaggotSender.h
|-- MaggotSession.cpp
|-- MaggotSession.h
|-- MaggotTcpPacket.cpp
|-- MaggotTcpPacket.h
|-- MaggotUdpChannel.cpp
|-- MaggotUdpChannel.h
|-- MainScheduler.cpp
|-- MainScheduler.h
|-- Makefile
|-- MptcpSession.cpp
|-- MptcpSession.h
|-- OutOfOrderQueue.cpp
|-- OutOfOrderQueue.h
|-- Packets.h
|-- Profiler.cpp
|-- Profiler.h
|-- ProxySocket.cpp
|-- ProxySocket.h
|-- RateCapped.h
|-- Receiver.cpp
|-- Receiver.h
|-- Reliable.h
|-- ReorderingQueue.cpp
|-- ReorderingQueue.h
|-- Retransmitter.cpp
|-- Retransmitter.h
|-- Running
|-- Safe_Queue.h
|-- Schedulable.h
|-- Session.cpp
|-- Session.h
|-- SessionKey.cpp
|-- SessionKey.h
|-- SharedLargeBufferPool.cpp
|-- SharedLargeBufferPool.h
|-- SharedPool.h
|-- TODO.txt
|-- TcpScheduler.cpp
|-- TcpScheduler.h
|-- TcpSession.cpp
|-- TcpSession.h
|-- TimerEventManager.cpp
|-- TimerEventManager.h
|-- UdpScheduler.cpp
|-- UdpScheduler.h
|-- UdpSession.cpp
|-- UdpSession.h
|-- Using
|-- Util.cpp
|-- Util.h
|-- VpnManager.cpp
|-- VpnManager.h
|-- b87db7824271
|-- build
| |-- CMakeCache.txt
| |-- CMakeFiles
| | |-- 3.7.0
| | | |-- CMakeCCompiler.cmake
| | | |-- CMakeCXXCompiler.cmake
| | | |-- CMakeDetermineCompilerABI_C.bin
| | | |-- CMakeDetermineCompilerABI_CXX.bin
| | | |-- CMakeSystem.cmake
| | | |-- CompilerIdC
| | | | |-- CMakeCCompilerId.c
| | | | `-- a.out
| | | `-- CompilerIdCXX
| | | |-- CMakeCXXCompilerId.cpp
| | | `-- a.out
| | |-- CMakeDirectoryInformation.cmake
| | |-- CMakeOutput.log
| | |-- CMakeTmp
| | |-- MaggotProxy.dir
| | | |-- AdvertisementServer.cpp.o
| | | |-- CXX.includecache
| | | |-- Channel.cpp.o
| | | |-- ControlSession.cpp.o
| | | |-- DependInfo.cmake
| | | |-- GlobalChannel.cpp.o
| | | |-- MaggotChannel.cpp.o
| | | |-- MaggotGarbageCollector.cpp.o
| | | |-- MaggotPacketQueue.cpp.o
| | | |-- MaggotScheduler.cpp.o
| | | |-- MaggotSender.cpp.o
| | | |-- MaggotSession.cpp.o
| | | |-- MaggotTcpPacket.cpp.o
| | | |-- MaggotUdpChannel.cpp.o
| | | |-- MainScheduler.cpp.o
| | | |-- MptcpSession.cpp.o
| | | |-- OutOfOrderQueue.cpp.o
| | | |-- ProxySocket.cpp.o
| | | |-- Receiver.cpp.o
| | | |-- ReorderingQueue.cpp.o
| | | |-- Retransmitter.cpp.o
| | | |-- Session.cpp.o
| | | |-- SessionKey.cpp.o
| | | |-- SharedLargeBufferPool.cpp.o
| | | |-- TcpScheduler.cpp.o
| | | |-- TcpSession.cpp.o
| | | |-- TimerEventManager.cpp.o
| | | |-- UdpScheduler.cpp.o
| | | |-- UdpSession.cpp.o
| | | |-- Util.cpp.o
| | | |-- VpnManager.cpp.o
| | | |-- build.make
| | | |-- cmake_clean.cmake
| | | |-- depend.internal
| | | |-- depend.make
| | | |-- flags.make
| | | |-- link.txt
| | | `-- progress.make
| | |-- Makefile.cmake
| | |-- Makefile2
| | |-- TargetDirectories.txt
| | |-- cmake.check_cache
| | |-- feature_tests.bin
| | |-- feature_tests.c
| | |-- feature_tests.cxx
| | `-- progress.marks
| |-- MaggotProxy
| |-- Makefile
| `-- cmake_install.cmake
|-- cmake_install.cmake
|-- df7eca2dfdec
|-- e3255b76c200
|-- empty.c
|-- log.txt
|-- log.txt~
|-- rateCap
|-- second-
|-- sniffer.c
`-- socketOpt.c
7 directories, 148 files
Removing intermediate container fec09156925b
---> 996a495e0747
Step 15/17 : RUN stat /home/mohd/project/MaggotProxyTest/build/CMakeFiles/3.7.0/CompilerIdCXX/a.out
---> Running in 6fff7ee1a160
File: '/home/mohd/project/MaggotProxyTest/build/CMakeFiles/3.7.0/CompilerIdCXX/a.out'
Size: 7168 Blocks: 16 IO Block: 4096 regular file
Device: 2eh/46d Inode: 150866 Links: 1
Access: (0755/-rwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2018-04-21 14:23:44.000000000 +0000
Modify: 2018-04-21 14:23:44.000000000 +0000
Change: 2018-04-21 14:23:45.834455655 +0000
Birth: -
Removing intermediate container 6fff7ee1a160
---> 157299bfb768
Step 16/17 : RUN chmod +x /home/mohd/project/MaggotProxyTest/build/CMakeFiles/3.7.0/CompilerIdCXX/a.out
---> Running in 74c5fd286be5
Removing intermediate container 74c5fd286be5
---> bbd04a80e568
Step 17/17 : CMD ["./home/mohd/project/MaggotProxyTest/build/CMakeFiles/3.7.0/CompilerIdCXX/a.out"]
---> Running in 2401dbf2ad3e
Removing intermediate container 2401dbf2ad3e
---> 00b888454e7e
Successfully built 00b888454e7e
Successfully tagged app_2:latest
sudo docker run -p 4000:80 my_app
docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"./home/mohd/project/MaggotProxyTest/build/CMakeFiles/3.7.0/CompilerIdCXX/a.out\": stat ./home/mohd/project/MaggotProxyTest/build/CMakeFiles/3.7.0/CompilerIdCXX/a.out: no such file or directory": unknown.
ERRO[0000] error waiting for container: context canceled
最佳答案
您已在此处更改了当前目录:
WORKDIR /home/mohd/project/MaggotProxyTest
CMD ["./home/mohd/project/MaggotProxyTest/build/CMakeFiles/3.7.0/CompilerIdCXX/a.out"]
/home/mohd/project/MaggotProxyTest/home/mohd/project/MaggotProxyTest/build/CMakeFiles/3.7.0/CompilerIdCXX/a.out
.
,使其成为绝对路径。
CMD ["/home/mohd/project/MaggotProxyTest/build/CMakeFiles/3.7.0/CompilerIdCXX/a.out"]
关于docker - Docker运行命令没有这样的文件或目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49930447/
好的,所以我想从批处理文件运行我的整个工作环境... 我想要实现什么...... 打开新的 powershell,打开我的 API 文件夹并从该文件夹运行 VS Code 编辑器(cd c:\xy;
我正在查看 Cocoa Controls 上的示例并下载了一些演示。我遇到的问题是一些例子,比如 BCTabBarController ,不会在我的设备上构建或启动。当我打开项目时,它看起来很正常,没
我刚刚开始学习 C 语言(擅长 Java 和 Python)。 当编写 C 程序(例如 hello world)时,我在 ubuntu cmd 行上使用 gcc hello.c -o hello 编译
我在 php 脚本从 cron 开始运行到超时后注意到了这个问题,但是当它从命令行手动运行时这不是问题。 (对于 CLI,PHP 默认的 max_execution_time 是 0) 所以我尝试运行
我可以使用命令行运行测试 > ./node_modules/.bin/wdio wdio.conf.js 但是如果我尝试从 IntelliJ 的运行/调试配置运行它,我会遇到各种不同的错误。 Fea
Error occurred during initialization of VM. Could not reserve enough space for object heap. Error: C
将 Anaconda 安装到 C:\ 后,我无法打开 jupyter 笔记本。无论是在带有 jupyter notebook 的 Anaconda Prompt 中还是在导航器中。我就是无法让它工作。
我遇到一个问题,如果我双击我的脚本 (.py),或者使用 IDLE 打开它,它将正确编译并运行。但是,如果我尝试在 Windows 命令行中运行脚本,请使用 C:\> "C:\Software_Dev
情况 我正在使用 mysql 数据库。查询从 phpmyadmin 和 postman 运行 但是当我从 android 发送请求时(它返回零行) 我已经记录了从 android 发送的电子邮件是正确
所以这个有点奇怪 - 为什么从 Java 运行 .exe 文件会给出不同的输出而不是直接运行 .exe。 当 java 在下面的行执行时,它会调用我构建的可与 3CX 电话系统配合使用的 .exe 文
这行代码 Environment.Is64BitProcess 当我的应用单独运行时评估为真。 但是当它在我的 Visual Studio 单元测试中运行时,相同的表达式的计算结果为 false。 我
关闭。这个问题是opinion-based .它目前不接受答案。 想要改进这个问题? 更新问题,以便 editing this post 可以用事实和引用来回答它. 关闭 8 年前。 Improve
我写了一个使用 libpq 连接到 PostgreSQL 数据库的演示。 我尝试通过包含将 C 文件连接到 PostgreSQL #include 在我将路径添加到系统变量 I:\Program F
如何从 Jenkins 运行 Android 模拟器来运行我的测试?当我在 Execiute Windows bath 命令中写入时,运行模拟器的命令: emulator -avd Tester 然后
我已经配置好东西,这样我就可以使用 ssl 登录和访问在 nginx 上运行的 errbit 我的问题是我不知道如何设置我的 Rails 应用程序的 errbit.rb 以便我可以运行测试 nginx
我编写了 flutter 应用程序,我通过 xcode 打开了 ios 部分并且应用程序正在运行,但是当我通过 flutter build ios 通过 vscode 运行应用程序时,我得到了这个错误
我有一个简短的 python 脚本,它使用日志记录模块和 configparser 模块。我在Win7下使用PyCharm 2.7.1和Python 3.3。 当我使用 PyCharm 运行我的脚本时
我在这里遇到了一些难题。 我的开发箱是 64 位的,windows 7。我所有的项目都编译为“任何 CPU”。该项目引用了 64 位版本的第 3 方软件 当我运行不使用任何 Web 引用的单元测试时,
当我注意到以下问题时,我正在做一些 C++ 练习。给定的代码将不会在 Visual Studio 2013 或 Qt Creator 5.4.1 中运行/编译 报错: invalid types 'd
假设我有一个 easteregg.py 文件: from airflow import DAG from dateutil import parser from datetime import tim
我是一名优秀的程序员,十分优秀!