I want to setup and run multiple oracle database docker containers on the same host (Red Hat OS), each database will use a separated area on the host to store data. These docker containers use the same docker image. For example:
- Container 1 will listen on port 1521 and store data in /home/user/oracle_data/container_1 folder on host.
- Container 2 will listen on port 1522 and store data in /home/user/oracle_data/container_2 folder on host.
- Container 3 will listen on port 1523 and store data in /home/user/oracle_data/container_3 folder on host.
Can you tell me the best practice to solve this task?
Thanks and best regards,
CodePudding user response:
Inside every container keep using the default port of 1521. Remap this port to external world to your custom port.
Same thing with folders - keep the folders the same inside the container, remap them to different folders in the host
For example, if using docker-compose, for the first container use:
ports:
1521:1521
volumes:
/oracle/data1:/oracle/data
for the second container use:
ports:
1522:1521
volumes:
/oracle/data2:/oracle/data