DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 963,274 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Cover image for How to install Oracle 18c and Docker on Ubuntu 20
Adriana GΓ³mez
Adriana GΓ³mez

Posted on

How to install Oracle 18c and Docker on Ubuntu 20

First Step: installing docker on ubuntu

  • Update your existing package list:

$ sudo apt update

  • Next, install some prerequisite packages that allow apt to use packages over HTTPS:

$ sudo apt install apt-transport-https ca-certificates curl software-properties-common

  • Then, add the GPG key for the official Docker repository on your system:

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

  • Add the Docker repository to the APT feeds:

$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"

  • Next, update the database package with the Docker packages from the newly added repository:

$ sudo apt update

  • Make sure you're about to install from the Docker repository instead of the default Ubuntu repository:

$ apt-cache policy docker-ce

While the Docker version number may be different, you will see an output like this
img2

  • Finally, install Docker:

$ sudo apt install docker-ce

  • Check that it works:

$ sudo systemctl status docker

the output will show that the service is active and running :)

Second Step: installing oracle 18c on docker

  • First extract the image from the docker repository:

$ sudo docker pull dockerhelp/docker-oracle-ee-18c

  • We run the Oracle 18c image and assign a port where it is going to communicate:

$ sudo docker run -p 7000:7000 -it dockerhelp/docker-oracle-ee-18c bash

  • We run the installation file sh:

$ sh post_install.sh

  • We proceed to connect to the database, always inside the container:

$ sqlplus

  • The user who creates us by default is the following:

USER: sys as sysdba

PASS: oracle

  • We enter and create a test user

SQL> alter session set "_ORACLE_SCRIPT"=true;

Session altered.

SQL> create user TEST identified by 1234;

User created.

SQL> grant dba to TEST;

The IP of the container can be found out by exiting the container (without turning it off) with
the key combination ctrl + p and then ctrl + q and running the following commands.

  • To display all containers that are active. In turn we will display the container id:

sudo docker ps

  • The following command is used to get the ip of the container:

sudo docker inspect -f '{{range
.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' [CONTAINER_ID]

where "CONTAINER_ID" is the id generated in the previous step.

Third Step: start an existing container in docker

  • The following commands are run to start the server:

sudo docker start aqui_tu_id_del_contenedor

sudo docker exec -it aqui_tu_id_del_contenedor bash

where "aqui_tu_id_del_contenedor" is the id of the container to start

  • In the case of oracle 18c, the following commands are executed for sign in:

sh post_install.sh

sqlplus

img3
so we finish the instalation, i hope i helped you :)

Top comments (0)

🌚 Life is too short to browse without dark mode