Skip to content

Instantly share code, notes, and snippets.

@goryszewskig
Forked from oehrlis/docker_build_orarepo.md
Created March 1, 2022 15:44
Show Gist options
  • Save goryszewskig/59976885fb79035008e274d9830b919a to your computer and use it in GitHub Desktop.
Save goryszewskig/59976885fb79035008e274d9830b919a to your computer and use it in GitHub Desktop.
Docker build using local software repository

Oracle Software usually can not be downloaded during build without providing some credentials. If the binaries are downloaded using curl or wget the credentials will remain in the docker image. One solution would be to keep the binaries in the docker build context and use squash or multi stage builds. Alternatively it is also possible to use a local web server (docker container) to download the files locally.

  • Start a simple web server to locally share the software during docker build.
docker run -dit \
  --hostname orarepo \
  --name orarepo \
  -p 80:80 \
  -v /data/docker/volumes/orarepo:/www \
  busybox httpd -fvvv -h /www
  • Get the IP of the web server
orarepo_ip=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' orarepo)
  • Using the local software repository during docker build
docker build --add-host=orarepo:${orarepo_ip} -t oracle/database:18.4.0.0 .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment