04. Docker practice - database articles

1. Download an available oracle image

1. Method 1: Search for available oracle images on Docker Hub, url: https://hub.docker.com/ 
Search for oracle 11g on the browser. 


 
You can view the details through the DETAILS link. The reason for choosing this image is very detailed. , and has Ubuntu 14.04 version (the local base image is 14.04, of course, it doesn't matter, when you download the image, all dependencies will be downloaded) 

 

 

 

2. Method 2: command line, docker search racle 


 

3. Download the mirror

  1. docker pull wnameless/oracle-xe-11g:14.04.4



 

4. View the local mirror

  1. docker images



 

Second, the use of mirroring

1. Start the container according to the image

     

docker run -d -p 49160:22-p 49161:1521-e ORACLE_ALLOW_REMOTE=true wnameless/oracle-xe-11g:14.04.4

 

注:Docker Hub上提示:Run this, if you want the database to be connected remotely:

    

docker run -d -p 49160:22-p 49161:1521-e ORACLE_ALLOW_REMOTE=true wnameless/oracle-xe-11g

 

This command will download the latest version of the mirror. You can specify the version by ":14.04.4" and use the mirror you just downloaded.

Description: 
-p 49160:22 -p 49161:1521 is to map the SSH service port 22 in the container to the local port 49160, and the Oracle port 1521 to the local port 49161

2. SSH login image 
The reason why this image is downloaded from Docker Hub is that this image has SSH installed and the description is detailed. Log in to SSH according to the description.

  1. ssh root@localhost -p 49160
  2. password:admin

 

 
illustrate:

  • The reason why port 49160 is used is that the SSH port 22 is mapped when the container is started
  • docker是安装在虚似机里的,如果希望在本地使用SSH工具来登陆虚似机里的docker容器的SSH,可以做vm的映口映射,如下图: 
    将虚似机IP和49160端口映射到本地的IP:127.0.0.4,端口:49999 


     

3.访问Oracle 


 

 

4.数据库工具连接Oracle 
URL:127.0.0.4 
PORT:49161 
SID:xe 


 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326268704&siteId=291194637