How can I plot an image with javascript, which I saved before in the docker workdir?

I’m running a docker container and inside this container, I’m saving an image to the workdir of the container. I want to plot this image on a website with javascript. Inside the container, is a flask service running.

Saving the plot to the workdir of the docker container:


my Dockerfile:

# Use an official Python runtime as a parent image
FROM python:3.5

# Set the working directory to /app
# Copy the current directory contents into the container at /app
COPY . /app

# Install any needed packages specified in requirements.txt
RUN pip install --trusted-host -r requirements.txt

# Make port 80 available to the world outside this container

# Define environment variable

# Run when the container launches
CMD ["python", ""]

Try to plot the image:

var img = document.createElement("img");
img.src = "/app/TrainingAccLoss.png";

When I’m trying to plot the image, I got an 404 Error.

GET http://localhost:4000/app/TrainingAccLoss.png 404 (NOT FOUND).

I don’t know if there is a possibility to access a file which is inside the workdir.

Source: StackOverflow