【 Docker 】Mac system use Docker to install Oracle

Install Oracle 11g using Docker on macOS

Mac OS uses Docker to install Oracle database

Install Docker

Download it from docker Store. Download the address is: store.docker.com/editions/co…

You can also see other operating system versions, such as centos version, AWS version,Ubuntu version, etc. On centos, you can use the wget command to download. Here we’re using the MAC version.

After downloading, we get the Docker. DMG file, click and drag it to the Application folder for installation.

You can log in.

Adjust the CPU memory allocation appropriately, such as half the resources.

Now docker is running successfully. After startup, you can check docker Info on the terminal.

docker info
Copy the code

Set docker Hub Mirror in China: Accelerates the process of pulling the image from the Docker Hub.

Landing docker

sudo docker login
Copy the code

Pull oracle image

Pull the Oracle image

docker pull alexeiled/docker-oracle-xe-11g
Copy the code

When the download is complete, start the image as a container:

docker run -h "oraclehost" --name "oracle" -d -p 1521:1521 alexeiled/docker-oracle-xe-11g

-h "oraclehost": specifies the hostname of the container as oracle --name"oracle": Name the container oracle-d: Runs in the background. -p: indicates port mapping. The format is: Host port: container portCopy the code

The hostname of the specified container is displayed as follows:

Look at the ID

docker ps
Copy the code

On the terminal, run the following command to access the container: 4eb60e809509 indicates the container ID

docker exec -it 4eb60e809509 /bin/bash
Copy the code

After entering the container, use the following command to log in :(log in as a normal user)

sqlplus system/oracle
Copy the code

Use Navicat to create connections.

Change the system password:

alter user system identified by zjj19970517;
Copy the code

Re-login:

Type exit; You can go back up one level.

Example Stop and start the Oracle service.

Reopening connection service:

Third, on pit

[1] The system is locked

The solution is to go in as the DBA and change the system state.

Use SYSDBA sys to log in first. The default password for both system and sys is oracle.

sqlplus sys/oracle as SYSDBA;
Copy the code

SQL> alter user system account unlock;

User altered.
Copy the code

[2] Incorrect hostName

Refer to the article