Skip to content

Commit 49c1bda

Browse files
committed
Align dev container Instant Client TZ data with Oracle server
gvenzl/oracle-free:latest and the bundled Instant Client can drift to different TZ data versions between releases, raising ORA-01805 on every TIMESTAMP WITH TIME ZONE operation. Mirror PR rsim#2734's CI workaround for the dev container: copy the server's timezlrg_*.dat into the client's oracore/zoneinfo and point ORA_TZFILE at it. Adds the docker-outside-of-docker feature plus a docker.sock bind mount on the app service so the dev container can run docker exec / docker cp against the sibling oracle service.
1 parent 8849c0b commit 49c1bda

3 files changed

Lines changed: 19 additions & 1 deletion

File tree

.devcontainer/devcontainer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"features": {
77
"ghcr.io/rails/devcontainer/features/ruby:2": {
88
"version": "4.0.4"
9-
}
9+
},
10+
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}
1011
},
1112
"customizations": {
1213
"vscode": {

.devcontainer/docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ services:
55
dockerfile: Dockerfile
66
volumes:
77
- ../..:/workspaces:cached
8+
- /var/run/docker.sock:/var/run/docker.sock
89
command: sleep infinity
910
network_mode: service:oracle
1011

.devcontainer/postCreateCommand.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,22 @@ if [ "$oracle_ready" != "true" ]; then
2020
exit 1
2121
fi
2222

23+
# Match Instant Client TZ data to the Oracle server's to avoid ORA-01805.
24+
echo "Aligning Instant Client TZ data with Oracle server..."
25+
ORACLE_CONTAINER=$(docker ps --filter "ancestor=gvenzl/oracle-free" -q | head -1)
26+
if [ -z "$ORACLE_CONTAINER" ]; then
27+
echo "Could not locate gvenzl/oracle-free container; skipping TZ alignment." >&2
28+
else
29+
SRC=$(docker exec "$ORACLE_CONTAINER" bash -c 'ls $ORACLE_HOME/oracore/zoneinfo/timezlrg_*.dat 2>/dev/null | head -1')
30+
echo "Server TZ file: $SRC"
31+
DST_DIR="$ORACLE_HOME/oracore/zoneinfo"
32+
sudo mkdir -p "$DST_DIR"
33+
docker cp "$ORACLE_CONTAINER":"$SRC" /tmp/_server_tzfile.dat
34+
sudo mv /tmp/_server_tzfile.dat "$DST_DIR/$(basename "$SRC")"
35+
ls -l "$DST_DIR"
36+
echo "export ORA_TZFILE=$DST_DIR/$(basename "$SRC")" | sudo tee /etc/profile.d/ora-tzfile.sh > /dev/null
37+
fi
38+
2339
ci/setup_accounts.sh
2440

2541
echo "Dev container setup complete. You are ready to start developing the Oracle Enhanced adapter!"

0 commit comments

Comments
 (0)