Skip to content

Commit d7bb100

Browse files
Update PostgreSQL image to latest and adjust volume path for data persistence
1 parent 448d9e8 commit d7bb100

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

src/ruby-rails-postgres/.devcontainer/docker-compose.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ services:
3232
db:
3333
# Use PostgreSQL 16 Alpine for stability and smaller image size
3434
# Pinned version avoids PostgreSQL 18+ compatibility issues with data directory format
35-
image: postgres:16-alpine
35+
image: postgres:latest
3636
restart: unless-stopped
3737
networks:
3838
- app-network # Connect to the same network as the app container
@@ -46,7 +46,7 @@ services:
4646
retries: 5 # Retry 5 times before marking as unhealthy
4747
start_period: 30s # Give PostgreSQL 30 seconds to start before health checks begin
4848
volumes:
49-
- postgres-data:/var/lib/postgresql/data
49+
- postgres-data:/var/lib/postgresql
5050
- ./create-db-user.sql:/docker-entrypoint-initdb.d/create-db-user.sql
5151
environment:
5252
POSTGRES_USER: postgres
@@ -74,17 +74,17 @@ services:
7474
# password: postgres
7575
# database: myapp_test
7676

77-
# Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally.
78-
# (Adding the "ports" property to this file will not forward from a Codespace.)
77+
# Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally.
78+
# (Adding the "ports" property to this file will not forward from a Codespace.)
7979

80-
# Persistent storage for PostgreSQL data
80+
# Persistent storage for PostgreSQL data
8181
volumes:
8282
postgres-data:
8383
# Named volume ensures data persists across container restarts
8484
# Located at /var/lib/postgresql/data inside the container
8585

86-
# Custom bridge network for service communication
87-
# Replaces the problematic network_mode: service:db approach
86+
# Custom bridge network for service communication
87+
# Replaces the problematic network_mode: service:db approach
8888
networks:
8989
app-network:
9090
driver: bridge # Standard bridge driver for container-to-container communication

0 commit comments

Comments
 (0)