How to run psql in Gitlab Docker image

When using the offical gitlab Docker container, you can use this command to run psql:

docker-exec-psql.sh
docker exec -t -u gitlab-psql [container name] psql -h /var/opt/gitlab/postgresql/ -d gitlabhq_production

In case you’re using a docker-compose based setup, use this command:

docker-compose-psql.sh
docker-compose exec -u gitlab-psql gitlab psql -h /var/opt/gitlab/postgresql/ -d gitlabhq_production

Note that gitlab in this command is the container name.


Check out similar posts by category: Databases, Docker, Linux