Use the yum-utils package to enable and install all the required repositories.
yum install -y yum-utils zip unzip
Then enable all the necessary repositories which are needed to install dockers
1.yum-config-manager –enable ol7_optional_latest
2.yum-config-manager –enable ol7_addons
Install the oraclelinux-developer-release-el7 for linux OEl 7
yum install -y oraclelinux-developer-release-el7
Enable the developer-release repository which we have downloaded earlier in the previous step using below command
yum-config-manager –enable ol7_developer
Install Docker and BTRFS using yum command
yum install -y docker-engine btrfs-progs btrfs-progs-devel
After installation of docker we have to enable and start the docker service using the below commands
systemctl enable docker.service
systemctl start docker.service
Next, we are checking the status of docker to verify whether it’s in active stage or not
systemctl status docker.service
Create a new sudo user to provide a access to the docker container, only through this user we can connect to the container
useradd docker_user
echo “docker_user ALL=(ALL) NOPASSWD: /usr/bin/docker” >> /etc/sudoers
echo “alias docker=\”sudo /usr/bin/docker\”” >> /home/docker_user/.bash_profile
su – docker_user
Login to the oracle container registry to pull the required images
docker login container-registry.oracle.com
In our case,we are installing oracle database with the version 19.3 so in the end we have provided the version name
docker pull container-registry.oracle.com/database/enterprise:19.3.0.0
Now we can spin up the container from the downloaded image by running the following command by specifying the container name and the port which we are going to use
docker run -d –name docker19c -p 1521:1521 container-registry.oracle.com/database/enterprise:19.3.0.0
Now we can set the password for oracle using the below command
docker exec docker19c ./setPassword.sh oracle
While spinning up the container, docker by itself creates a new container database along with listener and it might take 45 minutes to complete the installation setup
Once the installation is completed, we can connect to the oracle database in docker.
docker ps -a show all the available container in the server.
To connect to the desired container we have to use docker exec command with the container id
Now that, we have completed oracle database installation in docker.