Skip to content

Instantly share code, notes, and snippets.

@realsby
Last active July 23, 2018 13:06
Show Gist options
  • Save realsby/f1662109e80e3b5b0f134718001c11ee to your computer and use it in GitHub Desktop.
Save realsby/f1662109e80e3b5b0f134718001c11ee to your computer and use it in GitHub Desktop.
Postgresql and Redis with Docker
Docker shellden cikmak icin: ctrl + D
docker network create --driver bridge docker-network1
container icindeki postgresql portu 5432, container disinda gercek bilgisayarda 4321 den oraya erisimi aciyoruz.
docker run --name postgres1 --network docker-network1 -v /tmp/pgdata:/var/lib/postgresql/data -p 4321:5432 -e POSTGRES_PASSWORD=PPPPASSWORDDDDD -d postgres:9.6.9
docker run -it --rm --network docker-network1 postgres:9.6.9 psql -h postgres1 -U postgres
docker run -it --rm --network docker-network1 postgres:9.6.9 /bin/bash
silmek icin:
docker stop postgres1 && docker rm postgres1
baglanmak icin:
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'postgres',
'USER': 'postgres',
'PASSWORD': 'PPPPASSWORDDDDD',
'HOST': 'localhost',
'PORT': '4321',
}
container icindeki redis portu 6379, container disinda gercek bilgisayarda 6378 den oraya erisimi aciyoruz.
docker run --name redis1 --network docker-network1 -p 6378:6379 -d redis:3.2.12
docker network inspect docker-network1
docker container ls
docker run -p 8081:80 --network postgres-network -e "[email protected]" -e "PGADMIN_DEFAULT_PASSWORD=test123" -v "/tmp/pgadmin:/var/lib/pgadmin" -d dpage/pgadmin4
http://localhost:8081/browser/
[email protected]
test123
isimlendirilmis.. network disinda bitane..
docker run --name pgadmin -p 8085:80 -e "[email protected]" -e "PGADMIN_DEFAULT_PASSWORD=test123" -v "/tmp/pgadmin_not_in_network:/var/lib/pgadmin" -d dpage/pgadmin4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment