Tag: postgresql

连接到AWS实例上承载的Docker容器上的远程数据库

我有一个运行在Docker容器上的PostgreSQL数据库,IP_container容器的IP地址,并公开了端口5432,托pipe在AWS IP实例IP_instance上。 我的安全组允许端口5432上的所有TCP连接。 我无法使用IP_instance和端口5432从本地计算机上连接数据库(无法find主机)。 我错过了什么吗?

Docker – PG :: ConnectionBad

用Phusion Passenger运行Rails,目前遇到postgres问题,每当我运行构build命令时,我得到这个错误: PG::ConnectionBad (could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"? ): 我的Dockerfile FROM phusion/passenger-customizable MAINTAINER VodkaMD <support@nyvur.com> ENV RACK_ENV="production" RAILS_ENV="production" SECRET_KEY_BASE="e09afa8b753cb175bcef7eb5f737accd02a4c16d9b6e5d475943605abd4277cdf47c488812d21d9c7117efd489d876f34be52f7ef7e88b21759a079339b198ce" ENV HOME /root CMD ["/sbin/my_init"] RUN /pd_build/utilities.sh RUN /pd_build/ruby2.2.sh RUN /pd_build/python.sh RUN /pd_build/nodejs.sh # Custom instructions RUN apt-get […]

Django无法在Docker安装中连接到Postgres

我在使用Django和Postgres的Docker中设置了一个应用程序。 我无法从应用程序连接到Postgres。 当我运行: docker-compose run web python manage.py runserver docker-compose run web python manage.py migrate 我得到以下错误: django.db.utils.OperationalError: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"? 这是我的Dockerfile: FROM python:2.7 ADD requirements.txt /app/requirements.txt WORKDIR /app/ RUN pip install -r requirements.txt 我的docker-compose.yml: version: […]

如何将容器ip作为ENV传递给docker-compose文件中的其他容器

这是我的docker-compose文件: version: '3.0' services: app-web: restart: always build: ./web environment: PG_HOST: $(APP_DB_IP) PG_PORT: 5432 ports: – "8081:8080" links: – app-db app-db: build: ./db expose: – "5432" volumes: – /var/lib/postgresql/data 我想通过应用程序的Web应用程序数据库(在这种情况下Postgresql)的IP作为ENV VAR,所以它可以连接到数据库顺利…任何想法如何实现它?

Docker错误:standard_init_linux.go:185:exec用户进程导致“没有这样的文件或目录”

我试图用postgresql数据库设置我的elixir-phoenix应用程序来运行Docker。 这是我的Dockerfile的样子: # ./Dockerfile # Starting from the official Elixir 1.5.2 image: # https://hub.docker.com/_/elixir/ FROM elixir:1.5.2 ENV DEBIAN_FRONTEND=noninteractive # Install hex RUN mix local.hex # Install rebar RUN mix local.rebar # Install the Phoenix framework itself RUN mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez # Install NodeJS 6.x and the NPM RUN curl -sL https://deb.nodesource.com/setup_6.x | bash – RUN […]

Docker PostgreSQL – /docker-entrypoint-initdb.d中的脚本不运行

所以,我有一个这个结构的docker-compose项目: DockerDev – docker-compose.yaml – d-php – Dockerfile – scripts-apache – d-postgresql – Dockerfile – scripts – dev_data_setup.sql – logs – pgdata – www PHP,Redis,ElasticSearch是可以的。 但Postgresql不会运行dev_data_setup.sql,并find了我find的任何不同的/dockes-entrypoint-initdb.d解决scheme(卷,ADD,COPY等)。 我试图运行和sh脚本,什么也没有。 你能看到这个docker-compose和Dockerfile并帮助我吗? 谢谢 Dockerfile: FROM postgres:latest ADD ./scripts/dev_data_setup.sql /docker-entrypoint-initdb.d 泊坞窗,compose.yaml: version: '2' services: php: build: ./d-php/ hostname: www.domain.com ports: – "80:80" volumes: – ./www:/var/www/html – ./d-php/scripts-apache2/apache2.conf:/etc/apache2/apache2.conf – ./d-php/scripts-apache2/web.conf:/etc/apache2/sites-enabled/web.conf – […]

docker工人postgres无法启动指定的端口

我是新来的docker,我想用下面的命令运行一个postgres数据库泊坞窗: docker run –name rva-db -e POSTGRES_PASSWORD=rva -e POSTGRES_DB=rva-db -d postgres -p 5432:5432 如果我试图运行它没有-p选项,它似乎工作正常,但我不能从我的本地PDGpipe理达到它,我想我需要添加端口链接到达它。 无论如何,容器总是在几秒钟后崩溃,当我试图用启动命令启动它,我得到以下回报: docker start -a rva-db FATAL: invalid value for parameter "port": "5432:5432" 我错过了什么 ? 仅供参考,我使用以下docker版本在MacOS上运行它: $ docker version Client: Version: 1.12.1 API version: 1.24 Go version: go1.7.1 Git commit: 6f9534c Built: Thu Sep 8 10:31:18 2016 OS/Arch: darwin/amd64 Server: Version: 1.12.1 […]

如何设置database.yml连接到Postgres Docker容器?

我有一个Rails应用程序。 在开发和testing环境中,我想让Rails应用程序连接到dockerized Postgres。 Rails应用程序本身不会在一个容器中 – 只是Postgres。 我的database.yml应该是什么样子? 我有一个dockerdefault机器运行。 我创build了docker-compose.yml: postgres: image: postgres ports: – "5432:5432" environment: – POSTGRES_USER=timbuktu – POSTGRES_PASSWORD=mysecretpassword 我运行docker-compose up来让Postgres运行。 然后我运行docker-machine ip default来获取Docker虚拟机的IP地址,并相应地更新了database.yml: … development: adapter: postgresql host: 192.168.99.100 port: 5432 database: timbuktu_development username: timbuktu password: mysecretpassword encoding: unicode pool: 5 … 所以一切都很好,我可以在它的容器中连接到Postgres。 但是,如果其他人拉回购,他们将无法使用我的database.yml连接到Postgres,因为他们的Docker默认机器的IP地址将与我的不同。 那么如何改变我的database.yml来解决这个问题呢? 我有一个想法是要求他们通过运行docker-machine env default ,并将env DOCKER_HOST行粘贴到他们的bash_rc中来获取Docker默认机器的IP地址。 例如, export DOCKER_HOST="tcp://192.168.99.100:2376" […]

postgres-docker-container中无法连接php到db

我有一个debian wheezy服务器与Apache2。 该数据库是一个docker容器 – 标准postgres:9.1与端口5432暴露localhost:5434,数据文件夹是在一个自己的容器通过-v选项连接。 数据容器 docker run –name db-data -v / data -e PGDATA = / data -it –entrypoint / bin / bash postgres:9.1 数据库容器 docker run -d –name db -e POSTGRES_USER = name -e POSTGRES_PASSWORD = pwd -e PGDATA = / data -p 5434:5432 –volumes-from db-data postgres:9.1 我使用一个简单的PHP脚本来testing连接: $db = pg_connect("host=localhost port=5434 dbname=name […]

用docker-compose运行docker镜像

我有我的简单的应用程序在C#中,连接到PostgreSQL。 我想创build这个应用程序的形象,只是与docker运行。 我使用时一切正常: $ docker build $ docker run postgres $ docker run my_app 此外,当我使用从应用程序目录撰写时,一切都可以: $ docker-compose build $ docker-compose up 但是有没有机会使用docker-compose为我以前build造的图像? 我想发布这个图像到我的回购和我的团队的其他人只是下载并运行这个图像(应用程序+数据库)。 当我编写构build和下一步撰写运行my_app我连接到数据库时有exception: dbug: Npgsql.NpgsqlConnection[3] Opening connection to database 'POSTGRES_USER' on server 'tcp://postgres:5432'. Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.AggregateException: One or more errors occurred. (No […]