DNS无法在Docker中转换主机名

时间:2018-08-15 10:22:12

标签: django docker dns

这是我的docker文件:

FROM ubuntu:18.04
MAINTAINER bussiere "bussiere@toto.fr"
EXPOSE 8000
RUN echo "nameserver 8.8.8.8" >> /etc/resolv.conf
RUN echo "nameserver 80.67.169.12" >> /etc/resolv.conf
RUN echo "nameserver 208.67.222.222" >> /etc/resolv.conf
#RUN echo "dns-nameservers 8.8.8.8 8.8.4.4 80.67.169.12 208.67.222.222" >>  /etc/network/interfaces
ENV LANG C.UTF-8
ENV TZ=Europe/Paris
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update -y
RUN apt-get install -y --no-install-recommends apt-utils
RUN apt-get install -y python3 python3-pip python3-dev build-essential libpq-dev
RUN python3 -m pip install pip --upgrade
RUN python3 -m pip install pipenv
RUN export LC_ALL=C.UTF-8
RUN export LANG=C.UTF-8
COPY app /app
WORKDIR /app
RUN pipenv --python 3.6
RUN pipenv install -r requirements.txt
ENTRYPOINT ["pipenv"]
CMD ["run","python", "manage.py", "collectstatic", "--noinput"]
CMD ["run","python", "manage.py", "runserver", "0.0.0.0:8000"]

这是错误:

psycopg2.OperationalError: could not translate host name "toto.postgres.database.azure.com" to address: Temporary failure in name resolution

使用命令:

docker run --rm -it -p 8000:8000 admin_marque

当我尝试在浏览器中打开localhost:8000时。

主要目标是将其部署在天蓝色

这是一个django应用程序,我知道我不必在产品中使用django runserver,但我正在调试过程中。

我确定数据库的网址是正确的。

0 个答案:

没有答案