Skip to content

Instantly share code, notes, and snippets.

@oliveira-andre
Last active June 11, 2020 20:45
Show Gist options
  • Select an option

  • Save oliveira-andre/315ce4e915a24e0dfc9f88484c80be29 to your computer and use it in GitHub Desktop.

Select an option

Save oliveira-andre/315ce4e915a24e0dfc9f88484c80be29 to your computer and use it in GitHub Desktop.
configuring docker postgres
sudo docker run -d \
--name=pgadmin4 \
--restart=always \
-p 5050:80 \
-v /etc/localtime:/etc/localtime:ro \
--link postgres:db \
-e "[email protected]" \
-e "PGADMIN_DEFAULT_PASSWORD=root" \
dpage/pgadmin4
rails new my-app -d postgresql
#downloading postgree
sudo docker pull postgres
#install lib on linux
sudo apt-get install libpq-dev
# install lib on mac
brew install libpq
echo 'PATH="/usr/local/opt/libpq/bin:$PATH"' >> .zshrc
echo 'PKG_CONFIG_PATH="/usr/local/opt/libpq/lib/pkgconfig"' >> .zshrc
sudo mkdir /storage/pgdata -p
cd /storage
#setting up
sudo docker run -d \
--name=postgres \
-v /etc/localtime:/etc/localtime:ro \
-e POSTGRES_USER=root \
-e POSTGRES_PASSWORD=root \
--mount source=pgdata,target=/var/lib/postgresql/data \
-p 5432:5432 \
--restart=always \
postgres
#giving permissions
sudo chmod +777 /storage/pgdata
sudo chmod +777 /storage/pgdata/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment