Container runs Python 2.7 instead of Python 3.6
See original GitHub issuei have an app structured as follow:
app
app
main.py
Dockerfile
uwsgi.ini
docker-compose.yml
Dockerfile:
FROM tiangolo/uwsgi-nginx-flask:python3.6
RUN pip3 install gensim pymongo pandas numpy
docker-compose.yml:
version: '2'
services:
s_a:
build: ./app
links:
- s_db
volumes:
- ./app/app:/app
ports:
- "8080:80"
s_db:
image: mongo
ports:
- "27370:27017"
volumes:
- ./app/mongodb:/data/db
uwsgi.ini:
[uwsgi]
module = app.main
callable = app
master = true
processes = 10
when up docker-compose.yml i get the error:

I don’t know why the runs on Python 2.7 instead of Python 3.6. Where is the problem ?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Run Python Versions in Docker: How to Try the Latest Python ...
In this tutorial, you'll learn how to run different Python versions in Docker. By following the examples, you'll see how you can play...
Read more >Force RStudio to use Python 3.6 and not Python 2.7
How to force RStudio to use default system Python version (3.6 in my case) instead of 2.7? Default version of Python: username@usernameVB:~$ ...
Read more >Docker Says New Python Version Required
Running Docker version 20.10.1, build 831ebea on Linux Mint 20 Ulyana. ... python:3.6.9 and then tried to install fastparquet==0.3.2 there.
Read more >What's New In Python 3.8 — Python 3.11.1 documentation
They also re-appear in the box for the next customized run. One can also suppress the normal Shell main module restart. (Contributed by...
Read more >What's New In Python 3.9 — Python 3.11.1 documentation
Python 3.9 is the last version providing those Python 2 backward compatibility layers, ... Python 3.9 uses a new parser, based on PEG...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I just tried replicating your environment. But I didn’t get your error. I got a different one.
I had to move the file
uwsgi.inifrom./app/uwsgi.inito./app/app/uwsgi.inibecause that’s the directory that you are mounting.I had to change its contents to:
And then it ran without problems.
Now some development suggestions:
Dockerfileshould have aCOPYdirective copying your code.docker-compose.override.ymlthat doesn’t affect your finaldocker-compose.yml.You can create a public repo with your actual code and the steps to replicate the issue, that way I can take a look.
You can use the example template project as a base or a guidance to compare with what you have and see what you have to change. It includes the
docker-compose.ymlfiles.Actually, I don’t know, I don’t really know what was wrong and what was producing the error.
But I’m glad you solved it.
Should we close this issue?