Skip to content

Oracle DB prebuiltdb/Dockerfile - COPY destination must end with a slash #2905

@LeoniePhiline

Description

@LeoniePhiline

Bug trigger

  • Initialize an existing container image with ./buildExtensions.sh -x 'prebuiltdb',
  • with one or more setup scripts in OracleDatabase/SingleInstance/extensions/prebuiltdb/setup,
  • using the legacy docker builder (instead of BuildKit) in order to set the amount of memory available at initialization and use AUTO_MEM_CALCULATION.
DOCKER_BUILDKIT=0 ./buildExtensions.sh -b oracle-patched:19.3.0 -v 19.3.0 -t oracle-prebuilt:19.3.0 -x 'prebuiltdb'  -o '--memory=4096m --build-arg AUTO_MEM_CALCULATION=true'

Note that the extra build args are not required to trigger the bug - but they are required for setups which enable AUTO_MEM_CALCULATION.

As detailed in the prebuiltdb/README.md, BuildKit is disabled in order to be able to use the --memory build argument.

Reproduction note

Note that --memory is only available with DOCKER_BUILDKIT=0.

The Dockerfile reference describes:

If you specify multiple source files, either directly or using a wildcard, then the destination must be a directory (must end with a slash /).

However, the lack of a trailing slash in the COPY destination directory does not cause a fatal error when using BuildKit.

But with the legacy builder it does cause a fatal error - see section "Actual result" below.

We cannot use BuildKit as long as equivalents of --memory and cpuset-cpus are not supported.

Expected result

COPY succeeds:

Step 15/16 : COPY --chown=oracle:dba setup/* "$ORACLE_BASE"/scripts/extensions/setup/
 ---> acf9505d60b1

Actual result

COPY fails, if there is at least one file in the OracleDatabase/SingleInstance/extensions/prebuiltdb/setup directory:

Step 15/16 : COPY --chown=oracle:dba setup/* "$ORACLE_BASE"/scripts/extensions/setup
When using COPY with more than one source file, the destination must be a directory and end with a /

It does succeed, if the OracleDatabase/SingleInstance/extensions/prebuiltdb/setup directory is empty, as in that case, no copying occurs at all.

Fixing the bug

Add the missing slash:

diff --git a/OracleDatabase/SingleInstance/extensions/prebuiltdb/Dockerfile b/OracleDatabase/SingleInstance/extensions/prebuiltdb/Dockerfile
index 53e90be3..aef8fe2a 100644
--- a/OracleDatabase/SingleInstance/extensions/prebuiltdb/Dockerfile
+++ b/OracleDatabase/SingleInstance/extensions/prebuiltdb/Dockerfile
@@ -36,7 +36,7 @@ ENV ORACLE_PDB=${ORACLE_PDB}
 ENV ORACLE_PWD=${ORACLE_PWD}
 ENV AUTO_MEM_CALCULATION=${AUTO_MEM_CALCULATION:-false}
 
-COPY --chown=oracle:dba setup/* "$ORACLE_BASE"/scripts/extensions/setup
+COPY --chown=oracle:dba setup/* "$ORACLE_BASE"/scripts/extensions/setup/
 
 # Creating the database
 RUN "$ORACLE_BASE/$RUN_FILE" --nowait

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions