Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

431
Views
Docker image having apscheduler does not run at all

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:

datetime
apscheduler

The folder is flat. app.py and 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

docker images

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.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

There are two things here

You need to use docker run -it app1:ver3

-i: Interactive mode
-t: Enable TTY

I believe just -t also may do the job. See the link below for details

https://docs.docker.com/engine/reference/run/

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!