Ubuntu18.04虚拟机下,docker拉取Oralce镜像

Ubuntu18.04安装docker

(1.卸载)

sudo apt-get remove docker docker-engine docker.io containerd runc

2.安装Docker

sudo apt-get update
# 安装依赖包
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
# 添加 Docker 的官方 GPG 密钥
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# 验证您现在是否拥有带有指纹的密钥
sudo apt-key fingerprint 0EBFCD88
# 设置稳定版仓库
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

image

3.安装 Docker Engine-Community

# 更新
$ sudo apt-get update

# 安装Docker-ce
sudo apt-get install docker-ce

# 启动
sudo systemctl enable docker
sudo systemctl start docker

4.测试

sudo docker run hello-world

在Ubuntu18.04的Docker中安装Oracle镜像及简单使用

1.切换到root账号下,如果是普通账号,下面操作指令前面加sudo

2.搜索oracle镜像

docker search oracle

3.下载oracle镜像

docker pull registry.cn-hangzhou.aliyuncs.com/qida/oracle-xe-11g

4.查看镜像

docker images
docker images registry.cn-hangzhou.aliyuncs.com/qida/oracle-xe-11g

image
image

5.从下载的镜像创建并启动容器,这里把新建的容器命名为了oracle11

docker run -d -p 1521:1521 --name oracle11 registry.cn-hangzhou.aliyuncs.com/qida/oracle-xe-11g

6.查看所有容器

docker ps -a

image

7.进入已经启动的Oracle的容器

docker exec -it oracle11 bash

8.进入sqlplus

sqlplus /nolog

9.使用sysdba角色登录sqlplus

conn sys/oracle as sysdba

10.查看当前实例下的数据库

select name from v$database;

11.查看有多少个数据表

select count(*) from user_tables;

image

12.退出sqlplus

exit

13.退出容器

exit 或Ctrl+D

重新进入已经运行的oracle容器,重新执行下面指令

docker exec -it oracle11 bash

如果容器停用了,则重新启动, 用你实际的容器ID代替下面的container_ID

docker start container_ID

停用正在运行的容器

docker stop container_ID

参考:
https://www.runoob.com/docker/ubuntu-docker-install.html
https://www.bbsmax.com/A/LPdo1KWOJ3/

posted @ 2022-09-13 16:14  泥烟  阅读(95)  评论(0编辑  收藏  举报