/ / Création d'une image sur un conteneur Docker pour l'exécution de sa propre application Django - Python, Django, Docker

Création d'une image sur un conteneur Docker pour l'exécution de sa propre application Django - Python, Django, Docker

J'essaie de créer une image à exécuter dans un conteneur Docker avec une propre application Django existante à l'aide de la commande suivante

    sudo docker build -t avilaholding/clubmercado ~/Documents/docker/cmimage

mais je reçois cette erreur avec psycopg2 à la place

Collecting pathspec==0.3.4 (from -r /srv/clubmercado/requirements.txt (line 23))
Downloading pathspec-0.3.4.tar.gz
Collecting psycopg2==2.6.1 (from -r /srv/clubmercado/requirements.txt (line 24))
Downloading psycopg2-2.6.1.tar.gz (371kB)
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info/psycopg2.egg-info
writing pip-egg-info/psycopg2.egg-info/PKG-INFO
writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
writing manifest file "pip-egg-info/psycopg2.egg-info/SOURCES.txt"
warning: manifest_maker: standard file "-c" not found

Error: pg_config executable not found.

Please add the directory containing pg_config to the PATH
or specify the full executable path with the option:

python setup.py build_ext --pg-config /path/to/pg_config build ...

or with the pg_config option in "setup.cfg".

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-5wxAAo/psycopg2/
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the "pip install --upgrade pip" command.
The command "/bin/sh -c pip install -r $DOCKYARD_SRVPROJ/requirements.txt" returned a non-zero code: 1

Je pense que c’est peut-être parce qu’il s’exécute sur Python 2.7 mais que je veux l’utiliser sur Python 3.5.

Aussi, quand j'exécute pip --version ou pip3 --version

il dira que la version installée est déjà la version 9.0.1.

Réponses:

1 pour la réponse № 1

J'ai eu le même problème. Je l'ai corrigé en cours d'exécution

sudo apt-get install python-dev libpq-dev