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

时间:2017-03-01 19:50:33

标签: python django docker

我正在尝试构建一个用于在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 --version 要么 pip3 --version

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

1 个答案:

答案 0 :(得分:1)

我遇到了同样的问题。我修好了它

sudo apt-get install python-dev libpq-dev