79681200

Date: 2025-06-26 22:17:29
Score: 0.5
Natty:
Report link

To run in Docker:

host_directory> docker build --no-cache -t image-name .

host_directory> docker run -d image-name sleep infinity
The above line runs the container, and keeps running it, but does not actually
execute the python script.

Find the new running container name in Docker.

host_directory> docker exec -it container-name bash
The above line accesses the container terminal.

Go to the /app/ subdirectory if not already in it.

container-directory/app# python bar_graph.py
Now my_plot.png should be in container-directory/app

Exit the container terminal. This can be done with ctrl+Z

host_directory> docker cp container-name:./app/my_plot.png .
The above line copies my_plot.png to the current host directory.

Now my_plot.png should be accessible in the host directory.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: user30854646