GitLab使用官方的PostgreSQL和GitLabdocker容器设置不起作用
我正在尝试为GitLab和PostgreSQL使用不同的Docker容器来设置GitLab。 我使用RancherOS v1.0.3并启用了Kubernetes。 现在,我想要的是有一个单一的节点有两个容器。 后来,我会考虑在不同的节点上configuration它们。
[rancher@rancher-agent-2 ~]$ cat postgresql.sh docker run --name=postgresql -d \ --env 'DB_NAME=gitlabhq_production' \ --env 'DB_USER=gitlab' --env 'DB_PASS=password' \ --env 'DB_EXTENSION=pg_trgm' \ --volume /opt/postgresql:/var/lib/postgresql \ postgres:9.6.3 [rancher@rancher-agent-2 ~]$ cat gitlab.sh docker run --name=gitlab -d --link postgresql:postgresql \ -v /opt/gitlab/data:/var/opt/gitlab \ gitlab/gitlab-ce:9.3.9-ce.0
现在,当我运行PostgreSQL容器并尝试login时,我收到错误。
[rancher@rancher-agent-2 ~]$ docker exec -it postgresql bash root@a6cef780c594:/# psql -d gitlabhq_production -U gitlab psql: FATAL: role "gitlab" does not exist
似乎db( gitlabhq_production
)尚未创build。
root@a6cef780c594:/# psql -U postgres psql (9.6.3) Type "help" for help. postgres=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges -----------+----------+----------+------------+------------+----------------------- postgres | postgres | UTF8 | en_US.utf8 | en_US.utf8 | template0 | postgres | UTF8 | en_US.utf8 | en_US.utf8 | =c/postgres + | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | en_US.utf8 | en_US.utf8 | =c/postgres + | | | | | postgres=CTc/postgres (3 rows)
为什么不通过传递参数创build数据库?
更新:
PostgreSQL容器日志:
[rancher@rancher-agent-2 ~]$ docker logs postgresql The files belonging to this database system will be owned by user "postgres". This user must also own the server process. The database cluster will be initialized with locale "en_US.utf8". The default database encoding has accordingly been set to "UTF8". The default text search configuration will be set to "english". Data page checksums are disabled. fixing permissions on existing directory /var/lib/postgresql/data ... ok ... ... LOG: MultiXact member wraparound protections are now enabled LOG: database system is ready to accept connections LOG: autovacuum launcher started done server started ALTER ROLE /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/* ... ...
您正在使用错误的环境variables名称:
DB_NAME应该是POSTGRES_DB
DB_USER应该是POSTGRES_USER
DB_PASS应该是POSTGRES_PASSWORD
- 通过gitlab ci / docker运行构build
- 无法在GitLab CI上的docker镜像中导入django
- 在.gitlab-ci.yml中找不到curl命令
- 保持构build之后运行gitlab
- 在Docker上使用caching的Gitlab CI runnerconfiguration
- 我如何让gitlab-ci-runner的DinD图像caching中间图像?
- 为gitlab docker镜像备份代码库的适当策略是什么?
- 为什么我的Arquillian无人机functiontesting不适用于GitLab CI?
- sshd将git用户的login信息转发到(GitLab)Docker容器