Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
LeoniePhiline opened this issue Jan 22, 2025 · 0 comments · Fixed by #2906
Closed

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

LeoniePhiline opened this issue Jan 22, 2025 · 0 comments · Fixed by #2906
Assignees

Comments

@LeoniePhiline
Copy link

LeoniePhiline commented Jan 22, 2025

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
@aditya059 aditya059 linked a pull request Jan 23, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants