0

I created my own image from python app:

import calendar

print('Welcome to calendar')


year = int(input('Enter year'))
month = int(input('Enter number of month'))

print(calendar.month(year,month))
print('Good bye')

Docker file:


FROM python:alpine

WORKDIR /app

COPY . .
CMD [ "python","main.py" ]

After running comand docker run -it my-calendar (it's name of my image) i get back ID of my container, but it is not running. I dont know why.

I tried to do the same thing on Docker Desktop from Windows (with the same files python and Dockerfile) and it works correctly. I think it is problem in my ubuntu on virtual box. Can you help me?

  • 1
    When I try to reproduce your issue, the program works as it should. – Hans Kilian Feb 11 '23 at 10:23
  • Did you try on Ubuntu? – Reykon777 Feb 11 '23 at 10:44
  • Yes. Ubuntu 20.04. – Hans Kilian Feb 11 '23 at 11:01
  • 1
    I'm a little confused that you say that you get back the ID of the container when you run it. That's usually something to get when you have the `-d` option on your `docker run` command, but your command doesn't have that. I don't get the ID, when I run it. – Hans Kilian Feb 11 '23 at 11:19
  • Are you hitting [Python app does not print anything when running detached in docker](https://stackoverflow.com/questions/29663459/python-app-does-not-print-anything-when-running-detached-in-docker) maybe? – David Maze Feb 11 '23 at 12:39

0 Answers0