Ubuntu↑Docker | Docker ↑MySQL 笔记

Ubuntu ↑ Docker

1 Ubuntu 初始配置

sudo su
 ufw allow ssh
 ufw allow 22
 apt update 
 apt install openssh-server -y #安装ssh  # -y 确认安装
 apt install vim -y #安装Vim

# 首先备份源列表
 cp /etc/apt/sources.list /etc/apt/sources.list_backup
# 打开sources.list文件
 vim /etc/apt/sources.list

阿里云源(18TLS)

#  阿里源
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

刷新列表

sudo su
 apt-get update
 apt-get upgrade
 apt-get install build-essential

2 Ubuntu 安装 Docker

ubuntu server 安装 docker
sudo su
apt install docker.io -y
systemctl start docker 	#启动
systemctl enable docker	 #开机启动

3 Dockerfile 部署 SpringBoot

把 打包好的 jar文件(maven --> install), 放入以下文件中. (idea 右键jar–>Deployment–>上传) (Tools–>Deployment–>Configuration中配置 Deployment)

cd /home/springboot

mv -f /root/target/miaosha.jar /home/springboot/e

vim Dockerfile #如下 ↓ , 只需要修改 作者

你可能感兴趣的:(Java学习笔记,docker,ubuntu,mysql)