Skip to content

Align dev container Instant Client TZ data with Oracle server#2799

Merged
yahonda merged 1 commit into
rsim:masterfrom
yahonda:devcontainer-ora-tzfile
May 19, 2026
Merged

Align dev container Instant Client TZ data with Oracle server#2799
yahonda merged 1 commit into
rsim:masterfrom
yahonda:devcontainer-ora-tzfile

Conversation

@yahonda
Copy link
Copy Markdown
Collaborator

@yahonda yahonda commented May 19, 2026

Summary

Apply the workaround from #2734 to the dev container. CI fixed ORA-01805: possible error in date/time operation by copying the running Oracle server's timezlrg_*.dat into the Instant Client's oracore/zoneinfo/ and pointing ORA_TZFILE at it. The dev container is exposed to the same drift between gvenzl/oracle-free:latest and the bundled Instant Client and benefits from the same fix.

The earlier revision of this PR did the copy from inside the dev container via docker exec / docker cp, which dragged in the docker-outside-of-docker feature, a /var/run/docker.sock bind mount, and a moby: false workaround for Debian trixie — and made the dev container build hit a build-time GPG-key fetch that was flaky.

This revision moves the copy to the host, where Docker is already available.

Changes

  • .devcontainer/initializeCommand.sh (new) — pull gvenzl/oracle-free:latest, then extract $ORACLE_HOME/oracore/zoneinfo/timezlrg_*.dat from an ephemeral container into .devcontainer/tzdata/ on the host. No DB start, no readiness wait — the file ships in the image.
  • .devcontainer/devcontainer.jsoninitializeCommand now runs the new script (it previously just did the inline docker pull).
  • .devcontainer/docker-compose.yml — bind-mount .devcontainer/tzdata read-only at /opt/tzdata inside the app service.
  • .devcontainer/postCreateCommand.sh — set ORA_TZFILE from /opt/tzdata/timezlrg_*.dat and persist it via /etc/profile.d/ora-tzfile.sh so interactive shells and bundle exec runs pick it up.
  • .gitignore — ignore .devcontainer/tzdata/.

No docker-outside-of-docker feature, no /var/run/docker.sock bind, no moby: false workaround, and no network access during the dev container build.

Lifecycle

Matches #2734 — the step is unconditional and becomes a near-zero-cost no-op once the Instant Client and gvenzl image realign on a single TZ data version. Safe to remove together with the CI counterpart at that point.

Test plan

  • Rebuild the dev container; initializeCommand logs the pulled image and the extracted timezlrg_*.dat filename.
  • postCreateCommand logs "Using /opt/tzdata/timezlrg_*.dat for Instant Client TZ data."
  • In a fresh terminal inside the rebuilt container, echo $ORA_TZFILE resolves to the persisted path.
  • bundle exec rspec spec/active_record/oracle_enhanced/type/timestamp_spec.rb passes (all four examples).

@yahonda yahonda force-pushed the devcontainer-ora-tzfile branch 3 times, most recently from fc86a2f to d11547f Compare May 19, 2026 08:05
CI applies the same workaround in rsim#2734 to dodge ORA-01805 caused by
drift between gvenzl/oracle-free:latest and the bundled Instant Client.
Mirror it for the dev container without dragging the Docker CLI into
the dev container itself.

initializeCommand runs on the host, where Docker is already available.
Pull the gvenzl image and copy timezlrg_*.dat out of it via an
ephemeral container, dropping the file under .devcontainer/tzdata/ on
the host. docker-compose bind-mounts that directory read-only at
/opt/tzdata inside the dev container, and postCreateCommand exports
ORA_TZFILE from there and persists it via /etc/profile.d so interactive
shells and bundle exec runs pick it up.

The TZ data ships in the image, so the copy step does not start Oracle
or wait for the database. No docker-outside-of-docker feature, no
/var/run/docker.sock bind mount, and no GPG-key fetching at build time.
@yahonda yahonda force-pushed the devcontainer-ora-tzfile branch from d11547f to 4d754b0 Compare May 19, 2026 09:17
@yahonda yahonda merged commit 0e2d13b into rsim:master May 19, 2026
12 checks passed
yahonda added a commit to rsim/ruby-plsql that referenced this pull request May 19, 2026
Apply the workaround from #292 to the dev container. CI fixed
`ORA-01805: possible error in date/time operation` by copying the
running Oracle server's `timezlrg_*.dat` into the Instant Client's
`oracore/zoneinfo/` and pointing `ORA_TZFILE` at it. The dev container
combines `gvenzl/oracle-free:latest` with the Instant Client installed
via the app `Dockerfile`, so it is exposed to the same drift and
benefits from the same fix.

PR #301 ported the workaround by adding the
`docker-outside-of-docker` feature and copying the file from inside
the dev container via `docker exec` / `docker cp`. That approach
fails on Dev Containers 0.459.0 with the `mcr.microsoft.com/devcontainers/base:trixie`
base image because Debian trixie removed `moby-cli`:

    (!) The 'moby' option is not supported on Debian 'trixie' because
        'moby-cli' and related system packages have been removed from
        that distribution.
    ERROR: Feature "Docker (docker-outside-of-docker)" failed to install!

Move the copy to the host, where Docker is already available. Mirrors
rsim/oracle-enhanced#2799.

- `.devcontainer/initializeCommand.sh` (new) -- pull
  `gvenzl/oracle-free:latest`, then extract
  `$ORACLE_HOME/oracore/zoneinfo/timezlrg_*.dat` from an ephemeral
  container into `.devcontainer/tzdata/` on the host. No DB start, no
  readiness wait -- the file ships in the image.
- `.devcontainer/devcontainer.json` -- `initializeCommand` now runs
  the new script (it previously did the inline `docker pull`). The
  `docker-outside-of-docker` feature, added in #301 and never merged
  to master, stays absent.
- `.devcontainer/docker-compose.yml` -- bind-mount
  `.devcontainer/tzdata` read-only at `/opt/tzdata` inside the `app`
  service.
- `.devcontainer/postCreateCommand.sh` -- set `ORA_TZFILE` from
  `/opt/tzdata/timezlrg_*.dat` and persist it via
  `/etc/profile.d/ora-tzfile.sh` so interactive shells and
  `bundle exec` runs pick it up.
- `.gitignore` -- ignore `.devcontainer/tzdata/`.

No `docker-outside-of-docker` feature, no `/var/run/docker.sock` bind,
and no network access during the dev container build.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant