雷丰阳springboot之docker简介
maven的安装
https://www.cnblogs.com/liuhongfeng/p/5057827.html
maven配置使用阿里云镜像
https://www.cnblogs.com/pxblog/p/11617609.html
IDEA的基本设置
https://www.cnblogs.com/loveyoulx/p/9521731.html
基础环境搭建

centos7-atguigu.ova文件是雷丰阳打包好的linux环境。
virtualbox是一个虚拟机软件。
在virtualbox当中安装centos7-atguigu.ova。
然后使用smartty客户端连接虚拟机。
我使用的virtualbox的版本,如下图所示:




然后双击启动虚拟机。
虚拟机启动的问题
在启动虚拟机的过程中,出现了,这样的问题:

在这里,我进行了百度搜索:

找到了下面的这一篇文章:
https://blog.csdn.net/weixin_46250898/article/details/105660423
进行尝试解决问题:


顺利启动了虚拟机:

登录虚拟机
使用root/123456
这样的用户密码来进行登录。

使用linux客户端连接虚拟机进行登录

点击start a new ssh connection。

设置虚拟机的网络:

设置好虚拟机的网络之后,重启虚拟机的网络,使用如下的命令:service network restart
,这个是centos7版本下的重启网络的命令。

查看linux的ip地址:

查看本机的ip地址:

在smartty当中填写连接信息:


连接成功:

虚拟机ping不通主机的问题
参考:https://www.dazhuanlan.com/2020/02/11/5e420f2ea422a/
。



yum无法使用的问题

这个是网络问题,我也不知道,我是怎么解决的。
我只是重启了几次。这个在网络上,可以搜索到一些方案,可以挨个试试。
总之,在网络的设置上,虚拟机的网络,还是之前的图,是桥接的方式。
DOCKER相关
用windows镜像系统重装电脑的例子,来类比解释docker。

何为docker

docker核心概念

docker安装

常用操作

docker仓库




容器操作

第一步:docker search tomcat
,搜索镜像
第二步:docker pull tomcat:latest
,拉取镜像
第三步:docker run --name mytomcat -d tomcat:latest
,运行容器
第四步:docker ps
,查看运行中的容器
第五步:docker stop [CONTAINER ID]/[NAMES]
,停止运行中的容器
第六步:docker ps -a
,查看所有的容器,包括运行中的和已经停止的。
第七步:docker start [CONTAINER ID]
,启动容器。
第八步:docker rm [CONTAINER ID]
,删除容器。
第九步:docker run -d -p 8888:8080 tomcat
,端口映射启动tomcat。
第十步:service firewalld status
、service firewalld stop

第十一步:docker logs ec4db27df59c
,查看容器的日志的命令。

tomcat无法访问的问题

但是在这里,启动了tomcat之后,在浏览器中访问tomcat的页面,并不能够成功。
是下面的样子:

参考这篇文章解决问题:https://www.freesion.com/article/78451009722/
docker exec -it 44cd42493d0d /bin/bash

docker更多命令
https://docs.docker.com/engine/reference/commandline/docker/
可以参考每一个镜像的文档。
我们可以用一个镜像,启动多个容器。

环境搭建

安装mysql为例。

错误的启动命令:

正确的启动命令:

做了端口映射的启动命令:
docker run -p 3306:3306 --name mysql02 -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.5

测试一下连接:

mysql更多高级操作
更高级的操作,应该从官方仓库当中去看:https://hub.docker.com/
。
比如下面的这个,自定义mysql启动配置文件的方式。
docker run ‐‐name mysql03 ‐v /conf/mysql:/etc/mysql/conf.d ‐e MYSQL_ROOT_PASSWORD=my‐secret‐pw
‐d mysql:tag
把主机的/conf/mysql文件夹挂载到 mysqldocker容器的/etc/mysql/conf.d文件夹里面
改mysql的配置文件就只需要把mysql配置文件放在自定义的文件夹下(/conf/mysql)
docker run ‐‐name some‐mysql ‐e MYSQL_ROOT_PASSWORD=my‐secret‐pw ‐d mysql:tag ‐‐character‐set‐
server=utf8mb4 ‐‐collation‐server=utf8mb4_unicode_ci
指定mysql的一些配置参数