Using Docker getting exec format error when running

Viewed 18

I am attempting to complete a tutorial (Web Servers and API on C++ (Linkedin Learn)) and I am using Docker to build the web server.

I am running the following command: docker run -v /Users/arveanlabib/Desktop/cppweb:/usr/src/cppweb -p 8080:8080 -e PORT=8080 cppbox:latest /usr/src/cppweb/hello_crow/build/hello_crow

but I get an error message exec /usr/src/cppweb/hello_crow/build/hello_crow: exec format error.

Here are my files below: DockerFile

FROM gcc:7.3.0

RUN apt-get -qq update
RUN apt-get -qq upgrade
RUN apt-get -qq install cmake

RUN apt-get -qq install libboost-all-dev=1.62.0.1
RUN apt-get -qq install build-essential libtcmalloc-minimal4 && \
ln -s /user/lib/libtcmalloc_minimal.so.4 /usr/lib/libtcmalloc_minimal.so

main.cpp

#include "crow_all.h"
using namespace std;

int main(int argc, char* argv[]) {
  crow::SimpleApp app;

  CROW_ROUTE(app, "/")
  ([](){
    return "<div><h1>Hello, Crow.</h1></div>";
  });

  char* port = getenv("PORT");
  uint16_t iPort = static_cast<uint16_t>(port != NULL ? stoi(port): 10000);
  cout << "PORT = " << iPort << "\n";
  app.port(iPort).multithreaded().run();

}

CMakeLists.txt

cmake_minimum_required(VERSION 3.7)

project(hello_crow)

set(CMAKE_CXX_STANDARD 11)
set(THREADS_PREFER_PTHREAD_FLAG ON)

find_package(Boost COMPONENTS system filesystem REQUIRED)
find_package(Threads)

include_directories(${Boost_INCLUDE_DIRS})
add_executable(hello_crow main.cpp)
target_link_libraries(hello_crow ${Boost_LIBRARIES} Threads::Threads)

I would appreciate any help

0 Answers
Related