0
votes

I have next Dockerfile:

FROM ubuntu:16.04
ENV PYTHONIOENCODING=UTF-8
ENV PYTHONUNBUFFERED=1
ADD . /src
WORKDIR /src
ENTRYPOINT ["python3"]
CMD ["-u", "bot.py"]

This dockerfile is used with docker-compose:

version: '3'
services:
  something:
    build: .
    networks:
      - proxy
    volumes:
  - E:\tmp:/src/tmp
ports:
  - "6881-6889:6881-6889/udp"
  - "6881-6889:6881-6889/tcp"
  - "6891:6891/udp"
  - "6891:6891/tcp"
  - "6771:6771/udp"
  - "6771:6771/tcp"
  - "4433-4434:4433-4434/udp"
  - "4433-4434:4433-4434/tcp"
  tor:
    image: "dperson/torproxy"
    networks:
      - proxy
networks:
  proxy:
    driver: bridge

I'm running it with docker "Version 2.0.0.0-win81 (29211) Channel: stable Build: 4271b9e" on Windows 10: "docker-compose up -d"

There is a lot of logging to stdout in this python script. At this moment I'm printing everything with code like this: "print("Exception: " + str(exp), flush=True)"

And I'm almost every time can't get anything that was printed with "docker logs ". Sometimes I have parts of output (in right order). Mostly I have nothing. Why?

python 3.5.2

P.S. Sorry, flushing everything and everywhere is just my attempts, not a rule.

1
Can we see the contents of bot.py? From what you've described, seems like this could be a concurrency issue. - vasia

1 Answers

0
votes

I found root cause of the problem. I had 2 instances of same script.