Skip to content

ERROR: failed to solve: process "/bin/sh -c g++ -o HelloWorld helloworld.cpp" did not complete successfully: exit code: 1 #1

@Combuster54

Description

@Combuster54

Hi! I've been follow your first tutorial about HelloWorld and I've this issue.

combuster@combuster-desktop:~/Desktop/docker_examples/helloworld$ ls
Dockerfile  HelloWorld
combuster@combuster-desktop:~/Desktop/docker_examples/helloworld$ docker build -t hello0 .
[+] Building 0.3s (8/8) FINISHED                                                      docker:default
 => [internal] load build definition from Dockerfile                                            0.0s
 => => transferring dockerfile: 184B                                                            0.0s
 => [internal] load metadata for docker.io/amytabb/docker_ubuntu16_essentials:latest            0.0s
 => [internal] load .dockerignore                                                               0.0s
 => => transferring context: 2B                                                                 0.0s
 => [internal] load build context                                                               0.0s
 => => transferring context: 208B                                                               0.0s
 => [1/4] FROM docker.io/amytabb/docker_ubuntu16_essentials:latest                              0.0s
 => CACHED [2/4] COPY HelloWorld /HelloWord                                                     0.0s
 => CACHED [3/4] WORKDIR /HelloWorld/                                                           0.0s
 => ERROR [4/4] RUN g++ -o HelloWorld helloworld.cpp                                            0.2s
------                                                                                               
 > [4/4] RUN g++ -o HelloWorld helloworld.cpp:
0.201 g++: error: helloworld.cpp: No such file or directory
0.201 g++: fatal error: no input files
0.201 compilation terminated.
------
Dockerfile:4
--------------------
   2 |     COPY HelloWorld /HelloWord
   3 |     WORKDIR /HelloWorld/
   4 | >>> RUN g++ -o HelloWorld helloworld.cpp
   5 |     CMD ["./HelloWorld"]
--------------------
ERROR: failed to solve: process "/bin/sh -c g++ -o HelloWorld helloworld.cpp" did not complete successfully: exit code: 1

image

DockerFile

  FROM amytabb/docker_ubuntu16_essentials
  COPY HelloWorld /HelloWord
  WORKDIR /HelloWorld/
  RUN g++ -o HelloWorld helloworld.cpp
  CMD ["./HelloWorld"]

helloworld.cpp

#include <iostream>
using namespace std;
     
int main()
{
  cout << "Hello Docker world 0! " << std::endl;
  return 0;
}

Do you know how can I solve it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions