I am new to docker, so bear with me on this.
I have a
app.py file, which simply uses
apscheduler to print a sentence on the console. I have followed the structure from the official guide for the python file. When I run the file on my console, it runs as expected. (prints the Tick statement every 10 seconds.)
Now, I want to dockerize it and upload the image to dockerhub. I followed the docker documentations and this is how my
DockerFile looks like:
FROM python:3 COPY requirements.txt . COPY app.py . RUN pip install --trusted-host pypi.python.org -r requirements.txt CMD [ "python", "app.py" ]
I have listed the module names in
requirements.txt as below:
The folder is flat.
requirements.txt are in the same level in the directory.
| |- app.py |- requirements.txt
I use below commands to build the docker image:
docker build . -t app1:ver3
The docker image builds successfully and shows up when I do
Problem is, when I run the docker image with
docker run app1:ver3
the image does not show any output.
In fact the image shows as listed when I do
docker ps - which is expected but the run command should show me print statements on the console every 10 seconds.