0

Working on a Python Project where I need to separate out a child component from a parent component. The child component must use the parent component docker image as a base image and built its image upon it. Both of them uses wheel files for packaging.

How to run the child container by using parent as a dependency ?

  • What have you tried already? Is the "child component" just a Python library (so `COPY` its `.whl` file into the application image and `RUN pip install` it) or a full-blown image with additional native-library dependencies and other setup? You can build the application image `FROM` anything you want, even a locally-built image; see [How can I use a local image as the base image with a dockerfile?](https://stackoverflow.com/questions/20481225/how-can-i-use-a-local-image-as-the-base-image-with-a-dockerfile) – David Maze Mar 10 '21 at 10:54
  • I have a monolithic app which runs inside a Docker Container. Now I want to separate a small module out of it as a child component. The child component needs the parent component to run successfully. Therefore, I separated the Child component which has its own DockerFile and uses the Parent Component base image. Now, I am able to generate the whl files for both parent and child. But when I pip install, its not able to refer the parent component. Hence the child component conatiner, although it starts, doesnt run properly. – Code Enthusiast Mar 10 '21 at 15:46
  • Both are Python based packages. Below is a sample of child docker file. FROM base-image:latest #dist2 contains parent and child wheel files COPY src/dist /dist2 RUN ls /dist2/* ARG http_proxy ARG https_proxy ARG no_proxy RUN python3 -m pip install --user --upgrade setuptools wheel \ && python3 -m pip install /dist2/*.whl – Code Enthusiast Mar 10 '21 at 15:46

0 Answers0