How to deploy Oracle using Docker on Mac

How to deploy Oracle using Docker on Mac

How to deploy Oracle using Docker on Mac

First install docker

You can download Docker from the official website directly, but it seems that the speed of the official website is a bit slow. If you have the conditions, I recommend copying the download link and downloading it on Thunder (it will be faster if you have a membership~)

Docker official website

Docker Mac version download link

Other systems need to install Docker. Please go to the official website to select the system to install

After the download is complete, you need to drag the Docker icon into the application. After a successful installation, the Docker Logo will appear in the Mac launcher.

Docker Icon

At the same time, after the installation is successful, the Docker icon will appear at the top of the Mac, as shown below:

Docker

After the installation is complete, it starts by default. If you can see Docker Desktop is running as shown in the figure, it means that Docker is already available for use.

Install Oracle11g through Docker

We should first search in the remote repository of Docker, because Docker does not come with Oracle-related images. First, open the terminal that comes with Mac and enter the command as follows (determine whether to add sudo based on the actual situation of your Mac):

sudo docker search docker-oracle-xe-11g

If the Mac computer has run a command to modify the permissions of usr/local:

sudo chown -R $USER /usr/local

Then there is no need to add sudo for the corresponding operations afterwards.

Back to the installation steps:

After entering the search command in the command line, you will need to enter the mac password:

insert image description here

After entering the password:

insert image description here

After this screen appears, we select the one with the most starts to install. The command is as follows:

sudo docker pull deepdiver/docker-oracle-xe-11g

Because I have already installed it, the picture displayed is:

insert image description here

When you enter the above command for the first installation, you can see that the command line shows that the files are being downloaded. You just need to wait until all the files are completed and re-enter a new command before proceeding to the next step.
After the image is installed, we need to change it to a container. The command is as follows:

sudo docker run -d -p 1521:1521 --name oracle11g deepdiver/docker-oracle-xe-11g

It is worth noting that port 1521 inside the container is mapped to port 1521 in the host machine, so that it can be connected through database visualization management tools such as Navicat in the host machine. After this step is completed, we need to enter the container and perform a simple configuration of the installed Oracle.

Easily configure your Oracle database in the Oracle container and connect via Navicat

It should be noted here that if you use Navicat to connect, you need to use the professional version.
(1) First, enter docker ps in the command line to obtain the container ID

insert image description here

Copy the corresponding ID, as shown in the picture, mine is the first one.
Then enter:

sudo docker exec -it (your container ID) /bin/bash

After pressing Enter, enter the password and then enter:

sqlplus system/oracle 

insert image description here

Perform the following operations in sequence:
View the database username and password:

select username,password from dba_users;

Of course, you can log in to the database using an existing username and password. It is recommended to use a newly created user to log in to the database. The sql is as follows:

create user steafan(username) identified by password(password)

After creation, you can verify it through the following sql:

select * from all_users;

After creating a new user, you need to authorize the user. The permissions that the user has are specified by yourself. This is why it is recommended to use a custom user to log in to the database. The sql is as follows:

 grant connect,resource to STEAFAN (the username needs to be capitalized here, otherwise the authorization will fail)

connect means you have the permission to connect to the database; resource means you have the permission to operate the database

At this point, all the database configurations that need to be configured have been configured and can be connected through Navicat

When connecting, if Navicat is the professional version, you can select the database type to connect:

insert image description here

After selecting:

insert image description here

After the connection is successful, you can proceed. First, you need to open the connection by right-clicking on the connection name;

insert image description here

I have opened it here, then select the username you logged in as and right-click to open the mode:

insert image description here

Then, if table, view and other operation options appear under the user name or turn into color, it means success, and you can then create new queries, write SQL statements and other operations.

This is the end of this article about how to deploy and use Oracle with Docker on Mac. For more information about deploying and using Oracle with Docker, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • How to install Oracle_11g using Docker
  • How to quickly build an Oracle development environment using Docker
  • Detailed explanation of installing and configuring Oracle database in Docker
  • Tutorial on installing and configuring Oracle on Docker
  • Detailed tutorial on Docker pulling Oracle 11g image configuration

<<:  The simplest form implementation of Flexbox layout

>>:  Vue-cli creates a project and analyzes the project structure

Recommend

How to use CSS custom variables in Vue

Table of contents The CSS custom variable functio...

A brief analysis of the matching priority of Nginx configuration location

Preface The location in the server block in the N...

Essential knowledge for web development interviews and written tests (must read)

The difference between inline elements and block-...

How to prevent users from copying web page content using pure CSS

Preface When I was typing my own personal blog, I...

Detailed explanation of Strict mode in JavaScript

Table of contents Introduction Using Strict mode ...

How to achieve centered layout in CSS layout

1. Set the parent container to a table and the ch...

How to query or obtain images in a private registry

Docker queries or obtains images in a private reg...

Vue uses GraphVis to develop an infinitely expanded relationship graph

1. Go to the GraphVis official website to downloa...

Tips for making web table frames

<br />Tips for making web table frames. ----...

Linux operation and maintenance basic swap partition and lvm management tutorial

Table of contents 1. Swap partition SWAP 1.1 Crea...

MySQL 5.7.23 decompression version installation tutorial with pictures and text

Download the MySQL installer Official download ad...