Hi I am building a simple python image using docker. I am using ubuntu 22.04 and vs code as my editor. I have created a folder inside my local machine and used vs code to write simple python script and created a docker file using vs code and wrote the instructions inside it. My docker file is created in the local repo but inside the file there is no contents which I wrote using vs code.
I have to copy the content of Dockerfile from vs code and use vi
to paste inside the empty Dockerfile in my local repo.
Also the image gets built but does not show in docker ps
as a running state but as exited one in docker ps -a
Python Script -
import numpy as np
import matplotlib.pyplot as plt
a=np.arange(1,18)
plt.plot(a)
plt.show()
When running python3 file1.py
in cmd it displays the chart but when running sudo docker run graph.py
it does not show the graph.
What may be the issue ?
Kindly explain.
My dockerfile -
FROM python
COPY . /app
WORKDIR /app
RUN pip3 install -r requirements.txt
CMD python file1.py