admin管理员组

文章数量:1123195

I have below dockerfile

FROM mcr.microsoft/dotnet/runtime:8.0 AS base

RUN apt-get update
RUN apt-get install -y libmotif-dev build-essential

COPY . /usr/src/myapp

COPY oracle-outside-in-content-access-8.5.7.0.0-linux-x86-64/redist /usr/src/myapp/oracle-outside-in-content-access-8.5.7.0.0-linux-x86-64/sdk/demo

WORKDIR /usr/src/myapp/oracle-outside-in-content-access-8.5.7.0.0-linux-x86-64/sdk/samplecode/unix/
RUN make

WORKDIR /app

RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
USER appuser

COPY . .

For reference, locally I have following files in directory oracle-outside-in-content-access-8.5.7.0.0-linux-x86-64/sdk/samplecode/unix/

below is makefile

all:     casample taredir textdemo extract_archive extract_object memoryio parsepst batch_process_ca

.PHONY: all

taredir:
    @TARGET="taredir" \
    MAYBE_XPRINTER="" \
    TARGETDEPS="-lsc_da -lsc_ta -lsc_lo " \
    ./configure

textdemo:
    @TARGET="textdemo" \
    MAYBE_XPRINTER="" \
    TARGETDEPS="-lsc_da -lsc_ta -lsc_lo -lXm -lXt -lX11" \
    ./configure

casample:
    @TARGET="casample" \
    TARGETDEPS="-lsc_da -lsc_ca -DUNIX" \
    ./configure
    
extract_archive:
    @TARGET="extract_archive" \
    TARGETDEPS="-lsc_da" \
    ./configure
            
extract_object:
    @TARGET="extract_object" \
    TARGETDEPS="-lsc_da -lsc_ca" \
    ./configure    
    
memoryio:
    @TARGET="memoryio" \
    TARGETDEPS="-lsc_da -lsc_ca" \
    ./configure  

parsepst:
    @TARGET="parsepst" \
    TARGETDEPS="-lsc_da -lsc_ca" \
    ./configure      

batch_process_ca:
    @TARGET="batch_process_ca" \
    TARGETDEPS="-lsc_ca -lsc_da -DUNIX" \
    ./configure    

and one configure file (content of that may not be relevant for this question) on same path.

When I run docker build -t myapp-oracle-extract .

I get below error.

 => [base  7/11] WORKDIR /usr/src/myapp/oracle-outside-in-content-access-8.5.7.0.0-linux-x86-64/sdk/samplecode/unix/                                        1.0s 
 => ERROR [base  8/11] RUN make                                                                                                                             1.9s 
------
 > [base  8/11] RUN make:
1.149 /bin/sh: 1: ./configure: not found
1.149 make: *** [makefile:32: casample] Error 127
------
Dockerfile:46
--------------------
  44 |     WORKDIR /usr/src/myapp/oracle-outside-in-content-access-8.5.7.0.0-linux-x86-64/sdk/samplecode/unix/
  45 |     # This command compiles your app using GCC, adjust for your source code
  46 | >>> RUN make
  47 |
  48 |     WORKDIR /app
--------------------
ERROR: failed to solve: process "/bin/sh -c make" did not complete successfully: exit code: 2

Why it is unable to find ./configure even thought it has been copied. Does it run from different context? Why makefile is found but not configure file

I have below dockerfile

FROM mcr.microsoft.com/dotnet/runtime:8.0 AS base

RUN apt-get update
RUN apt-get install -y libmotif-dev build-essential

COPY . /usr/src/myapp

COPY oracle-outside-in-content-access-8.5.7.0.0-linux-x86-64/redist /usr/src/myapp/oracle-outside-in-content-access-8.5.7.0.0-linux-x86-64/sdk/demo

WORKDIR /usr/src/myapp/oracle-outside-in-content-access-8.5.7.0.0-linux-x86-64/sdk/samplecode/unix/
RUN make

WORKDIR /app

RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
USER appuser

COPY . .

For reference, locally I have following files in directory oracle-outside-in-content-access-8.5.7.0.0-linux-x86-64/sdk/samplecode/unix/

below is makefile

all:     casample taredir textdemo extract_archive extract_object memoryio parsepst batch_process_ca

.PHONY: all

taredir:
    @TARGET="taredir" \
    MAYBE_XPRINTER="" \
    TARGETDEPS="-lsc_da -lsc_ta -lsc_lo " \
    ./configure

textdemo:
    @TARGET="textdemo" \
    MAYBE_XPRINTER="" \
    TARGETDEPS="-lsc_da -lsc_ta -lsc_lo -lXm -lXt -lX11" \
    ./configure

casample:
    @TARGET="casample" \
    TARGETDEPS="-lsc_da -lsc_ca -DUNIX" \
    ./configure
    
extract_archive:
    @TARGET="extract_archive" \
    TARGETDEPS="-lsc_da" \
    ./configure
            
extract_object:
    @TARGET="extract_object" \
    TARGETDEPS="-lsc_da -lsc_ca" \
    ./configure    
    
memoryio:
    @TARGET="memoryio" \
    TARGETDEPS="-lsc_da -lsc_ca" \
    ./configure  

parsepst:
    @TARGET="parsepst" \
    TARGETDEPS="-lsc_da -lsc_ca" \
    ./configure      

batch_process_ca:
    @TARGET="batch_process_ca" \
    TARGETDEPS="-lsc_ca -lsc_da -DUNIX" \
    ./configure    

and one configure file (content of that may not be relevant for this question) on same path.

When I run docker build -t myapp-oracle-extract .

I get below error.

 => [base  7/11] WORKDIR /usr/src/myapp/oracle-outside-in-content-access-8.5.7.0.0-linux-x86-64/sdk/samplecode/unix/                                        1.0s 
 => ERROR [base  8/11] RUN make                                                                                                                             1.9s 
------
 > [base  8/11] RUN make:
1.149 /bin/sh: 1: ./configure: not found
1.149 make: *** [makefile:32: casample] Error 127
------
Dockerfile:46
--------------------
  44 |     WORKDIR /usr/src/myapp/oracle-outside-in-content-access-8.5.7.0.0-linux-x86-64/sdk/samplecode/unix/
  45 |     # This command compiles your app using GCC, adjust for your source code
  46 | >>> RUN make
  47 |
  48 |     WORKDIR /app
--------------------
ERROR: failed to solve: process "/bin/sh -c make" did not complete successfully: exit code: 2

Why it is unable to find ./configure even thought it has been copied. Does it run from different context? Why makefile is found but not configure file

Share Improve this question edited 7 hours ago Anonymous Creator asked 8 hours ago Anonymous CreatorAnonymous Creator 3,7899 gold badges36 silver badges92 bronze badges 10
  • Clearly, the current directory or the container config is not what you think it is. Edit your recipe in the makefile and have it run pwd to show the current directory and ls to show what's in the directory before it tries to run ./configure. That should give you some hints. – MadScientist Commented 8 hours ago
  • Also, be sure that the ./configure script is executable and that the interpreter on the first line of the script (e.g., #!/bin/sh typically) exists (that is, /bin/sh exists). Sometimes you get slightly confusing errors when you try to run an interpreted script but the interpreter can't be found or fails for some reason. – MadScientist Commented 8 hours ago
  • Your question title has a DOS-style backslash path separator. Are you working on a Windows host? Is it possible the configure script has DOS line endings, which could cause this issue in a Linux container? – David Maze Commented 7 hours ago
  • (Your Makefile doesn't actually seem to be building the targets like casample. Do you have the same problem if you RUN ./configure, without the Make wrapper?) – David Maze Commented 7 hours ago
  • @DavidMaze Yes. Had checked that it also has not found problem with simple RUN ./configure – Anonymous Creator Commented 7 hours ago
 |  Show 5 more comments

1 Answer 1

Reset to default 0

File Permissions Issue:

1: In the Docker build context, the files you copy into the container retain their permissions unless explicitly changed.

2: If the configure file does not have execute (+x) permissions locally, it will not be executable in the container.

Updated Dockerfile:

FROM mcr.microsoft.com/dotnet/runtime:8.0 AS base

RUN apt-get update RUN apt-get install -y libmotif-dev build-essential

COPY . /usr/src/myapp

WORKDIR /usr/src/myapp/oracle-outside-in-content-access-8.5.7.0.0-linux-x86-64/sdk/samplecode/unix/

RUN chmod +x ./configure

RUN ls -l

RUN make

WORKDIR /app

RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R

appuser /app

USER appuser

COPY . .

本文标签: netMakefile unable to find configure inside dockerStack Overflow