Home > OS >  how to containerize a Django project with Oracle Database
how to containerize a Django project with Oracle Database

Time:08-05

I am trying to containerize my Django project and set up a docker image for the Oracle Database. I am getting an error while I run docker-compose build:

service "oracle-db" refers to undefined volume oracle: invalid compose project

My docker-compose file is:

 version: "3"

 services:
     django:
build:
  context: .
  dockerfile: django.Dockerfile
image: kanbanboard_django
restart: unless-stopped
volumes:
  - "django-static:/app/django-static"
  - "media:/app/media"
  - "./backend/settings:/app/settings"
env_file:
  - .env
depends_on:
  - oracle-db

certbot:
  image: certbot/certbot
  entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
volumes:
  - "./data/certbot/conf:/etc/letsencrypt"
  - "./data/certbot/www:/var/www/certbot"

 oracle-db:
  image: sath89/oracle-19c
  volumes:
    - oracle:/u01/app/oracle/
  env_file:
    - .env

 volumes:
  media:
  django-static:

CodePudding user response:

You need to define your volume at the end of your docker-compose in order to use it in your container.

You should replace:

volumes:
  media:
  django-static:

by:

volumes:
  media:
  django-static:
  oracle:
  • Related