我不能安装PostgreSQL 9.5这是我在Docker文件中的时候
Dockerfile行
RUN apt-get update && apt-get install -qq -y build-essential libpq-dev postgresql-client-9.5 --fix-missing --no-install-recommends
它运行下面的命令。
remote: E: Package 'postgresql-client-9.5' has no installation candidate
remote:
The command '/bin/sh -c apt-get update && apt-get install -qq
-y build-essential libpq-dev postgresql-client-9.5 --fix-missing
--no-install-recommends' returned a non-zero code: 100
当我在UbuntuXenial上的时候,它似乎在尝试从Debian存储库中进行适当的更新。可能出了问题,因为我为Debian安装了第一个错误的Docker版本,然后我用
sudo apt-get remove docker docker-engine docker.io
sudo rm -rf /var/lib/docker
在这之后,我为我的Ubuntu Xenial发行版安装了Docker。我不明白为什么当我运行Docker文件时,它仍然更新包并尝试安装Debian的包,当我没有任何与Debian相关的包时?
安装的Docker版本是
Docker version 17.05.0-ce, build 89658be
从
https://apt.dockerproject.org/repo/pool/main/d/docker-engine/docker-engine_17.05.0~ce-0~ubuntu-xenial_amd64.deb
以下是运行apt-get-update时的代码:
remote: ---> Running in b8d8101adf4a
remote: ---> f9286d1e85d1
remote: Removing intermediate container b8d8101adf4a
remote: Step 3/11 : RUN apt-get update && apt-get install -qq -y build-essential libpq-dev postgresql-client-9.5 mysql-client-5.7 --fix-missing --no-install-recommends
remote: ---> Running in 9bda34235687
remote: Ign:1 http://deb.debian.org/debian stretch InRelease
remote: Get:2 http://deb.debian.org/debian stretch-updates InRelease [91.0 kB]
remote: Get:3 http://security.debian.org/debian-security stretch/updates InRelease [94.3 kB]
remote: Get:4 http://deb.debian.org/debian stretch Release [118 kB]
remote: Get:5 http://deb.debian.org/debian stretch-updates/main amd64 Packages [12.1 kB]
remote: Get:6 http://security.debian.org/debian-security stretch/updates/main amd64 Packages [440 kB]
remote: Get:7 http://deb.debian.org/debian stretch Release.gpg [2434 B]
remote: Get:8 http://deb.debian.org/debian stretch/main amd64 Packages [9530 kB]
remote: Fetched 10.3 MB in 13s (789 kB/s)
remote: Reading package lists...
文档文件:
FROM python:2.7
MAINTAINER Makkasi <makkasi@abv.bg>
RUN apt-get update && apt-get install -qq -y build-essential libpq-dev postgresql-client-9.5 --fix-missing --no-install-recommends
ENV INSTALL_PATH /project1
RUN mkdir -p $INSTALL_PATH
WORKDIR $INSTALL_PATH
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
COPY . .
VOLUME ["static"]
CMD gunicorn -b 0.0.0.0:8000 "project1.app:create_app()"
docker-compose.yml:
postgres:
image: postgres:9.5
environment:
POSTGRES_USER: makkasi
POSTGRES_PASSWORD: somepassword
ports:
- '5432:5432'
volumes:
- ~/.docker-volumes/project1/postgresql/data:/var/lib/postgresql/data
redis:
image: redis:2.8.22
ports:
- '6379:6379'
volumes:
- ~/.docker-volumes/project1/redis/data:/var/lib/redis/data
project1:
build: .
command: gunicorn -b 0.0.0.0:8000 --reload --access-logfile - "project1.app:create_app()"
environment:
PYTHONUNBUFFERED: true
links:
- postgres
- redis
volumes:
- .:/project1
ports:
- '8000:8000'