How to Run Oracle XE with Docker
This guide helps you spin up an Oracle XE container using the official Oracle Docker image, then connect to it either through the container or your local environment.
π¦ 1. Prerequisites
- Docker is installed on your system
- Basic familiarity with connecting to an Oracle database
π 2. Pull the Oracle XE Docker Image
Pull the image:
docker pull container-registry.oracle.com/database/express:latest
π 3. Run the Oracle XE Container
Run the container and expose the default Oracle ports:
docker run -d \
--name oracle-xe \
-p 1521:1521 \
-p 5500:5500 \
-e ORACLE_PWD=MySecurePassword123 \
container-registry.oracle.com/database/express:latest
Note: Replace MySecurePassword123
with a password of your choice.
π 4. Check Logs and Wait for Initialization
Check the logs to ensure the database is ready:
docker logs -f oracle-xe
Wait for the message:DATABASE IS READY TO USE!
π 5. Connect Using docker exec
+ SQLPlus
You can connect from inside the container like this:
docker exec -it oracle-xe sqlplus sys/MySecurePassword123@//localhost/XEPDB1 as sysdba
π» 6. Connect from Host CLI (if sqlplus
is installed)
If you have Oracle Instant Client or SQL*Plus installed locally, connect with:
sqlplus sys/MySecurePassword123@localhost:1521/XEPDB1 as sysdba
π 7. Default Database Info
Item | Value |
---|---|
DB Name | XEPDB1 (PDB) |
Port | 1521 |
SYS Password | As set by ORACLE_PWD |
SID | XE |
π§Ή 8. Stop and Remove the Container
docker stop oracle-xe
docker rm oracle-xe