README.md | 1 year ago | ||
build.sh | 5 years ago | ||
docker-compose.yml | 1 year ago | ||
osmdb.properties | 3 years ago | ||
pgpass.txt | 1 year ago | ||
start.sh | 1 year ago | ||
stop.sh | 5 years ago |
Use by DockerHub kartoza/postgis:9.6-2.4
Use by DockerHub dpage/pgadmin4
空のディレクトリを作成
$ mkdir ./dbdata
$ vi docker-compose.yml
version: '3' services: postgis: image: kartoza/postgis:9.6-2.4 container_name: osmdb restart: always volumes: - dbdata:/var/lib/postgresql/ ports: - 5432:5432 environment: POSTGRES_USER: alex POSTGRES_PASS: password POSTGRES_DBNAME: osmdb ALLOW_IP_RANGE: 0.0.0.0/0 pgadmin4: image: dpage/pgadmin4 container_name: pgadmin4 ports: - 80:80 environment: PGADMIN_DEFAULT_EMAIL: pgadmin@mail.com PGADMIN_DEFAULT_PASSWORD: password volumes: dbdata:
$ docker-compose up -d
Creating network "postgis_default" with the default driver Creating volume "postgis_dbdata" with default driver Creating pgadmin4 ... Creating osmdb ... Creating pgadmin4 Creating osmdb ... done
$ docker-compose ps
4-1) webブラウザ: http://localhost
4-2) pgAdmin4 : Login
pgadmin@mail.com
password
4-3) pgAdmin4 : 接続 / Connection
172.17.0.1
5432
postgres
alex
password
通常停止
$ docker-compose down
停止(DBデータ削除)
$ docker-compose down -v
"PostGIS"を起動する
kartoza/postgis:9.6-2.4
1) docker pull kartoza/postgis:9.6-2.4
2) WORKAREA=$(pwd)
3) mkdir $HOME/pg_data
4) docker run --name=osmdb -m 2g -d -e POSTGRES_USER=alex -e POSTGRES_PASS=password -e POSTGRES_DBNAME=osmdb -e ALLOW_IP_RANGE=0.0.0.0/0 -p 5432:5432 -v $HOME/pg_data:/var/lib/postgresql --restart=always kartoza/postgis:9.6-2.4
param | comment |
---|---|
--name=osmdb |
|
-m 2g |
momory 2GB |
-e POSTGRES_USER=gisuser |
|
-e POSTGRES_PASS=password |
|
-e POSTGRES_DBNAME=osmdb |
|
-e ALLOW_IP_RANGE=0.0.0.0/0 |
すべてのIPからの接続を許可する |
-p 5432:5432 |
|
-v $HOME/pg_data:/var/lib/postgresql |
PostgreSQL databade data folder |
--restart=always |
$ docker pull kartoza/postgis:9.6-2.4 $ mkdir $ mkdir $HOME/pg_data $ docker run -m 2g --name=gisdb -d -e POSTGRES_USER=alex -e POSTGRES_PASS=password -e POSTGRES_DBNAME=osmdb -e ALLOW_IP_RANGE=0.0.0.0/0 -p 5432:5432 -v $HOME/pg_data:/var/lib/postgresql --restart=always kartoza/postgis:9.6-2.4 $
1) docker pull dpage/pgadmin4
2) docker run --name=pgadmin4 -p 80:80 -e "PGADMIN_DEFAULT_EMAIL=gisuser@domain.com" -e "PGADMIN_DEFAULT_PASSWORD=gisuser" -d dpage/pgadmin4
param | comment |
---|---|
--name=pgadmin4 | |
-e "PGADMIN_DEFAULT_EMAIL=gisuser@domain.com" | |
-e "PGADMIN_DEFAULT_PASSWORD=gisuser" |
3) pgAdmin4 : Login
http://localhost/
gisuser@domain.com
gisuser
4) pgAdmin4 : 接続 / Connection
172.17.0.1
5432
postgres
alex
password
osmdb.properties
db_driver=org.postgresql.Driver db_url=jdbc:postgresql://172.17.0.1:5432/osmdb db_user=alex db_passwd=password
echo '*:*:*:alex:password' > /root/.pgpass echo '*:*:*:postgres:password' >> /root/.pgpass echo '*:*:*:gisuser:password' >> /root/.pgpass chmod 600 /root/.pgpass
stop pgAdmin4 docker stop stupefied_poitras
stop postGIS docker stop postgis