Note how to build postgres, pgadmin4 environment with docker
docker-compose.yml
version: '3'
services:
pgadmin4:
build: pgadmin4
container_name: pgadmin4
volumes:
- pgadmin4_data:/var/lib/pgadmin
environment:
- PGADMIN_DEFAULT_EMAIL=[Initial login address]
- PGADMIN_DEFAULT_PASSWORD=[Initial login password]
ports:
- "80:80"
postgres:
image: postgres:latest
container_name: postgres
volumes:
- postgres_data:/var/lib/postgresql/data
environment:
- POSTGRES_USER=【user】
- POSTGRES_PASSWORD=【password】
- POSTGRES_INITDB_ARGS=--encoding=UTF-8 --locale=C
- TZ=Asia/Tokyo
ports:
- 5432:5432
volumes:
pgadmin4_data:
external:
name: pgadmin4_data
postgres_data:
external:
name: postgres_data
Dockerfile
FROM dpage/pgadmin4
USER root
RUN apk update \
&& apk add --update --no-cache tzdata \
&& cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime \
&& echo "Asia/Tokyo" > /etc/timezone \
&& apk del tzdata
EXPOSE 80
Recommended Posts