I am attempting to create a docker-compose file that will start a Rails 3.2.13 server and link it to an Oracle DB. So far I have been unable to make the connection from Rails to the Oracle DB. This is the error from Rails
oci8.c:513:in oci8lib_191.so: ORA-12154: TNS:could not resolve the connect identifier specified (OCIError)
docker-compose.yml
version: '3.1'
services:
app:
image: local-rails:0.0.1
build: .
ports:
- "3000:3000"
volumes:
- "${PWD}:/usr/src/app"
depends_on:
- db
command: bundle exec rails s -p 3000 -b '0.0.0.0'
db:
image: wnameless/oracle-xe-11g
environment:
- ORACLE_ALLOW_REMOTE=true
ports:
- "49160:22"
- "49161:1521"
Variables in my Dockerfile
ENV RAILS_ENV local
# Notice the use of "db" service name as the HOST
ENV RAILS_DB (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db)(PORT=49161))(CONNECT_DATA=(SID=xe)))
# I've also tried setting DATABASE_URL directly w/ no yml config
# ENV DATABASE_URL db:49161/xe
database.yml
local:
adapter: oracle_enhanced
database: <%= RAILS_DB %>
username: ****
password: ****
I have successfully started both services separately - Rails pointing to external Oracle DB with known working configurations. I have also been able to connect to the containerized Oracle DB via Oracle SQL Developer. The problem is getting them to talk to one another.