fbpx

Oracle Docker Compose with Persistent Volume

To use Docker Compose to set up an Oracle database with a persistent volume, you can define a services block in your docker-compose.yml file that specifies the configuration for your Oracle service. This block should include the image for the Oracle service, as well as any configuration options and environment variables that you want to set.

For example, the following docker-compose.yml file sets up an Oracle service using the official Oracle Database Enterprise Edition image, and specifies that the data files for the database should be stored in a persistent volume named “oracle-data”:

				
					version: '3'
services:
  oracle:
    image: oracle/database:12.2.0.1-ee
    volumes:
      - oracle-data:/opt/oracle/oradata
    environment:
      ORACLE_PWD: mypassword
      ORACLE_SID: mydb
      ORACLE_PDB: mypdb
      ORACLE_CHARACTERSET: AL32UTF8
volumes:
  oracle-data:

				
			

To create and start the Oracle service, you can run the following command from the directory containing your docker-compose.yml file:

				
					docker-compose up -d

				
			

This will create the Oracle service and the persistent volume, and start the Oracle service in the background. You can then connect to the Oracle service using a client like SQL*Plus, and use the environment variables specified in the environment block of the docker-compose.yml file to authenticate.

To stop the Oracle service, you can run the following command:

				
					docker-compose down

				
			

This will stop the Oracle service and remove the containers and volumes associated with the service. However, the data in the persistent volume will be preserved, so when you restart the service using docker-compose up, the data will be available in the database.

Share:

Facebook
Twitter
Pinterest
LinkedIn

Social Media

Most Popular

Get The Latest Updates

Subscribe To Our Weekly Newsletter

No spam, notifications only about new products, updates.

Categories