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

Slim Docker image no longer includes wget, so installation guide needs update #1201

Closed
GaryGSC opened this issue Jan 22, 2020 · 6 comments
Closed

Comments

@GaryGSC
Copy link

GaryGSC commented Jan 22, 2020

First off, thank you for adding the Docker section to the installation guide. It's quite helpful!

Since wget is no longer included in node:12-buster-slim or any of the newest -slim images (nodejs/docker-node#1185), this section could use a change to either install wget or to use the full image rather than slim.

@cjbj
Copy link
Member

cjbj commented Jan 22, 2020

@GaryGSC thanks for the comment.

I guess I also need to update https://blogs.oracle.com/opal/docker-for-oracle-database-applications-in-nodejs-and-python-part-1 (and I haven't got part 2 finished yet!)

@sosoba
Copy link

sosoba commented Feb 14, 2020

I suggest using the ADD directive instead of using wget / curl inside the container:

ADD https://download.oracle.com/otn_software/linux/instantclient/instantclient-basiclite-linuxx64.zip /tmp/instantclient-basiclite.zip

@cjbj
Copy link
Member

cjbj commented Feb 14, 2020

@sosoba I read in https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#add-or-copy "Because image size matters, using ADD to fetch packages from remote URLs is strongly discouraged; you should use curl or wget instead." Does your experience differ?

In practice it's probably better to download Instant Client to the machine running Docker, and just add the files into the image. This way there is no repeated download cost.

@sosoba
Copy link

sosoba commented Feb 14, 2020

I didn't notice the difference. Maybe it's a warning against using COPY / ADD with an asterisk? BTW the best solution is mulliayer Dockerfile which "reset" layers and copy only needed files:

ARG NODE_VERSION=13.8.0
FROM node:${NODE_VERSION}-stretch-slim AS build-env
ADD https://download.oracle.com/otn_software/linux/instantclient/195000/instantclient-basiclite-linux.x64-19.5.0.0.0dbru.zip /tmp/instantclient-basiclite.zip
RUN apt-get update \
  && apt-get install -y libaio1 bsdtar \
  && apt-get clean \
  && mkdir /opt/instantclient \
  && bsdtar --strip-components=1 -xvf /tmp/instantclient-basiclite.zip -C /opt/instantclient \
  && cd /opt/instantclient \
  && rm -f *jdbc* *occi* *mysql* *jar uidrvci genezi adrci libipc1.so libmql1.so

FROM node:${NODE_VERSION}-stretch-slim
COPY --from=build-env /opt/instantclient/ /opt/instantclient/
COPY --from=build-env /lib/x86_64-linux-gnu/libaio.so.1 /lib/x86_64-linux-gnu/libaio.so.1
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/instantclient

@cjbj
Copy link
Member

cjbj commented Feb 14, 2020

Thanks for sharing. I had one multistage builder example in my blog post.

With your Dockerfile, I'd probably make it a more generic example and use ldconfig instead of setting LD_LIBRARY_PATH; for other uses setting the env var can be error prone e.g. when subshells start with clean environments.

@cjbj
Copy link
Member

cjbj commented Feb 18, 2020

@GaryGSC I updated the 5.0 doc on the master branch; it will become production documentation when 5.0 is released.

I'll close this now. Thanks for the report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants