In this article I'll show you how to install oracle database in a container docker
Create a Docker container with Oracle Database
To create a Docker Container with Oracle Database we need to log in at docker account. To do this, type this command bellow in your terminal:
docker login
And put your registered login like this print bellow:
Now let's go to pull the docker image. To do this, just type this command bellow:
docker pull store/oracle/database-enterprise:12.2.0.1
Create a container
Our next step will be to create a container, to do this, we just need this command bellow:
docker run -d -p 1521:1521 --name oracle store/oracle/database-enterprise:12.2.0.1
This command will create a oracle database container with the name oracle using the version 12.2.0.1, working in port 1521:1521.
After the installation is completed, we can connect to the Oracle SQL Plus tool to create users and grant the necessary permissions as follows.
docker exec -it oracle bash -c "source /home/oracle/.bashrc; sqlplus /nolog"
Now let's to connect as sysdba in Docker
connect sys as sysdba;
And create your Oracle User:
create user your_username identified by your_password;
After this grant permission to your new user:
GRANT ALL PRIVILEGES TO YOUR_USER_NAME;
NOTE: You can grant permissions for certain privileges such as SELECT, INSERT, UPDATE, CREATE TABLE instead of ALL PRIVILEGES, I granted all priviles just to show how you can do this in this article.
Now to connect to SQL Developer in Docker you can use this connetion bellow:
Username: username
Password: password
Hostname: localhost
Port: 1521
Service name: ORCLCDB.localdomain
Top comments (1)
You'll love the slim images from Gerald Venzl (Oracle Database Product Manager)!
docker pull gvenzl/oracle-xe:21.3.0-slim
Check it here