这里需要先学Linux基本命令
安装docker
在docker里边拉取
安装步骤都会在这里写到
我用的阿里云服务器,连接成功,如图所示:
安装Docker(yum安装)
课程连接:安装docker
基于 CentOS 7 安装
-
确定你是CentOS7及以上版本
[root@192 Desktop]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core)
-
yum安装gcc相关(需要确保 虚拟机可以上外网 )
yum -y install gcc yum -y install gcc-c++
-
卸载旧版本
yum -y remove docker docker-common docker-selinux docker-engine # 官网版本 yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine
-
安装需要的软件包
yum install -y yum-utils device-mapper-persistent-data lvm2
-
设置stable镜像仓库
# 错误,国外的 yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo ## 报错 [Errno 14] curl#35 - TCP connection reset by peer [Errno 12] curl#35 - Timeout # 正确推荐使用国内的,阿里云的 yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
-
更新yum软件包索引
yum makecache fast
-
安装Docker CE 社区版
yum -y install docker-ce docker-ce-cli containerd.io
-
启动docker
systemctl start docker
-
测试
docker version
hello-world
docker run hello-world
查看一下下载的这个hello-world镜像
docker images
docker部署mysql
[root@hyf home]# docker pull mysql
Using default tag: latest
latest: Pulling from library/mysql
a076a628af6f: Already exists
f6c208f3f991: Pull complete
88a9455a9165: Pull complete
406c9b8427c6: Pull complete
7c88599c0b25: Pull complete
25b5c6debdaf: Pull complete
43a5816f1617: Pull complete
1a8c919e89bf: Pull complete
9f3cf4bd1a07: Pull complete
80539cea118d: Pull complete
201b3cad54ce: Pull complete
944ba37e1c06: Pull complete
Digest: sha256:feada149cb8ff54eade1336da7c1d080c4a1c7ed82b5e320efb5beebed85ae8c
Status: Downloaded newer image for mysql:latest
docker.io/library/mysql:latest
# -d后台启动 --name 重命名 -p端口
[root@hyf home]# docker run -d --name docker_mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD="root" mysql
docker部署Oracle11g
参考链接:https://blog.csdn.net/zwx521515/article/details/77982884
# 1、创建容器
[root@hyf /]# docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
Using default tag: latest
latest: Pulling from helowin/oracle_11g
ed5542b8e0e1: Pull complete
a3ed95caeb02: Pull complete
1e8f80d0799e: Pull complete
Digest: sha256:4c12b98372dfcbaafcd9564a37c8d91456090a5c6fb07a4ec18270c9d9ef9726
Status: Downloaded newer image for registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g:latest
registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g:latest
# 2、启动容器
[root@hyf /]# docker run -d -p 1521:1521 --name oracle_11g registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
80ccc1606f758de3e164ee82be216050339cae31670eb4e316c398b31958725e
# 3、开启
[root@hyf /]# docker start oracle_11g
oracle_11g
# 4、进入容器终端
[root@hyf /]# docker exec -it oracle_11g /bin/bash
[oracle@80ccc1606f75 /]$ su root
Password: helowin
[root@80ccc1606f75 /]# vi /etc/profile
# 添加并保存
export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2
export ORACLE_SID=helowin
export PATH=$ORACLE_HOME/bin:$PATH
# 5、软件连接
[root@80ccc1606f75 /]# ln -s $ORACLE_HOME/bin/sqlplus /usr/bin
# 6、root换Oracle
[root@80ccc1606f75 /]# su - oracle
[oracle@80ccc1606f75 ~]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Wed Apr 7 09:16:07 2021
Copyright (c) 1982, 2009, Oracle. All rights reserved.
# 连接
SQL> conn /as sysdba
Connected.
# 7、修改 system密码
SQL> alter user system identified by oracle;
User altered.
# 修改 sys码
SQL> alter user sys identified by oracle;
User altered.
SQL> alter profile default limit password_life_time unlimited;
Profile altered.
## navicat登陆:
# sid/服务名: helowin
# 用户名 system
# 密码 oracle