Create DockerFile with Tensorflow

Hi Team , i have installed tensorflow in docker container. Size of image is going approx 2.6 GB
I tried to solve size issue using multistage dockerfile build and below is my dockerfile.
Please help me with 2 questions

  1. how can i check inside docker exec that tensorflow is installed or not because below command is giving me nothing(below command i tried in exec)

    pip show tensorflow
    warning: Package(s) not found: tensorflow
  2. is my below docker file is correct?


FROM python:3.8 AS builder
COPY . /app

#inside requirement.txt we have tensorflow==2.12
RUN pip install --no-cache-dir -r requirements.txt

FROM python:3.8.10-slim
COPY --from=builder /app /app