Home > Net >  How to modify the Dockerfile of a pulled docker image?
How to modify the Dockerfile of a pulled docker image?

Time:05-17

I have to pull the latest image from https://catalog.ngc.nvidia.com/orgs/nvidia/containers/tensorflow

docker pull nvcr.io/nvidia/tensorflow:22.04-tf2-py3

How do I modify the Dockerfile in order to add the following commands?

  RUN apt-get update
  RUN apt install -y python3-pip
  RUN pip3 install --upgrade pip
  RUN pip3 install --upgrade setuptools

  COPY requirements.txt ./
  RUN pip3 install -r requirements.txt

With requirements.txt being a file containing this text

https://github.com/hojonathanho/diffusion/blob/master/requirements.txt

I think that, as an alternative, I could write my own Dockerfile, but I don't know where to find the one that I need.

I am doing this on a remote workstation.

CodePudding user response:

Create a new dockerfile like so:

this should to the trick

https://docs.docker.com/engine/reference/builder/#from

FROM nvcr.io/nvidia/tensorflow:22.04-tf2-py3
RUN apt-get update
RUN apt install -y python3-pip
RUN pip3 install --upgrade pip
RUN pip3 install --upgrade setuptools

COPY requirements.txt ./
RUN pip3 install -r requirements.txt
  • Related