在Docker容器上构build图像以运行自己的Django应用程序

我试图build立一个图像在Docker容器中运行一个自己的Django应用程序执行以下命令

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

但我得到这个错误与psycopg2相反

 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 

我想这可能是因为它运行在python 2.7上,但是我希望它运行在python 3.5上。 我在Ubuntu 16.04上安装了这两个版本。

另外,当我执行pip --versionpip3 --version

它会说已安装的版本已经是9.0.1版本。

我有同样的问题。 我修好了它运行

 sudo apt-get install python-dev libpq-dev