Docker入门实战——mysql镜像使,使用Dockerfile创建自己的镜像

【云原生】Docker基于Dockerfile多级构建,实现缩小镜像体积 7)使用多阶段构建; 阅读详情

mysql镜像使

安装docker

1.yum安装

yum install docker -y

启动docker

systemctl enable docker #设置docker开机自启
systemctl start docker #开启docker

获得mysql镜像

1.搜索镜像

docker search mysql

可以看到有很多mysql镜像我们直接选择stats最多的镜像

2.从远处库拉取镜像

docker pull mysql

3.查看镜像

docker images

Docker入门实战——mysql镜像使,使用Dockerfile创建自己的镜像

 

运行mysql

docker run –name mysqlTest - p 3307:3306 \
-e MYSQL_ROOT_PASSWORD=123456 \
-d mysql

–name #镜像运行的名称,也就是container的名称
-p 3307:3306 将这个contariner的3306端口映射到宿主机3307端口
-e 设置变量
-d 表示在后台运行
查看容器

docker ps

Docker入门实战——mysql镜像使,使用Dockerfile创建自己的镜像

 

进入容器,并创建数据库和表

docker exec -it mysqlTest bash
mysql -uroot -p

输入密码:123456

Docker入门实战——mysql镜像使,使用Dockerfile创建自己的镜像

 

创建数据库和表
create database test
use test
create table user(id VARCHAR(20),name VARCHAR(25),age INT(4))

Docker入门实战——mysql镜像使,使用Dockerfile创建自己的镜像

 

编写代码连接mysql

注:这里我用的是golang,其他语言也一样。只需要知道ip是0.0.0.0,端口是我们之前自己设定的3306到3309的3309端口。


        
基于Dockerfile 构建镜像--Nginx、Tomcat、Mysql 镜像 1:构建 Nginx 镜像 Nginx是一款轻量级的web服务器,也是一款优秀的反向代理服务器 1)下载基础镜像 # docker pull centos:7 2)建立工作目录 # mkdir nginx # cd nginx # rz -E 把 nginx-1.12.0.tar.gz 软件包复制过来 3)创建并编写Dockfile文件 # vim Dockerfile FROM centos... 阅读详情

相关推荐

Docker | 使用Dockerfile制作镜像

大家好,我是Leo哥🫣🫣🫣,这篇文章中,我们学习了什么是镜像,以及如何自定义镜像。这篇文章我们主要讲一下如果使用Dockerfile快速制作镜像、好了,话不多说让我们开始吧😎😎😎。以上便是本文的全部内容,本人才疏学浅,文章有什么错误的地方,欢迎大佬们批评指正!我是Leo,一个在互联网行业的小白,立志成为更好的自己。如果你想了解更多关于Leo,可以关注公众号-程序员Leo,后面文章会首先同步至公众号。

分享思想,留下痕迹。 4240

RK3568嵌入式Linux多屏显示开发指南

摘要:本篇RK3568嵌入式Linux多屏显示开发指南详细介绍了基于Qt应用层的实现方案。文章首先概述了技术架构,说明从Qt应用到硬件显示的完整流程。然后提供了两种实现方案:推荐使用Qt内置多屏支持方案,包含完整的C++代码示例和配置文件说明;对于需要精细控制的场景,给出了基于libdrm API的底层实现方案。最后重点讨论了屏幕旋转处理和多屏协同工作模式的关键技术要点,包括扩展桌面、镜像模式等实现方法。

froxy的专栏 1572

Dify沙盒容器部署实战:解决config.yaml缺失与系统调用权限问题

本文详细解析了Dify沙盒容器部署中的两大常见问题:config.yaml缺失与系统调用权限限制。通过实战步骤指导如何正确配置卷挂载解决`no such file or directory`错误,并深入讲解如何调整`allowed_syscalls`白名单应对`error: operation not permitted`权限问题,帮助开发者高效完成Dify容器化部署。

gg901的博客 922

C#菜鸟教程学习笔记

C#菜鸟教程学习笔记 C#简介 C# 是一种编程语言,它是由微软开发的。 C# 编程是基于 C 和 C++ 编程语言的,它与 Java 也非常相似。 C# 是 .Net 框架的一部分,且用于编写 .Net 应用程序。 .Net 框架(.Net Framework)能编写出下面类型的应用程序: ①Windows 应用程序 ②Web 应用程序 ③Web 服务 常用的C# 编程的开发工具:Visual Studio(VS:可视化工作室) C#程序结构 一个 C# 程序(C# 文件的后缀为 .cs)主要包括以下部分

mlc_WTMOTW的博客 4978

部署资源管理系统chemx

资源管理系统的部署教程

weixin_40784215的博客 822

从0开始使用ArcGIS实现克里金(Kriging)插值(适用数学建模竞赛,详解)

适用:数学建模学习中遇到需要进行克里金(Kriging)插值的任务。希望尽快上手,选择出恰当的半函数模型,并获得插值后的图片。 详细步骤: 一、准备数据 在excel中准备需要进行克里金插值的内容,应该包括至少三列:X坐标,Y坐标,数据。在每一列的列首做好标记,方便导入ArcMap后对应。注意存储时存为xls文件。 二、将数据导如导ArcMap 点击下面这个标记,把数据文件添加到ArcMap。 如果是初次使用的化,可能会不知道进入添加数据对话框之后如何操作。这时应该先点击红框标记的图标,连接到文件夹。

east_fence的博客 4万+

RAG系统中Embedding模型选型实战

本文详细介绍了RAG系统中Embedding模型选型实战,希望能对学习RAG的同学们有所帮助。 文章目录 1. 前言 2. 思路解析 3. 测评数据集构建 3.1 步骤一 3.2 步骤二 3.3 数据示例 3.4 总结 4. 实战代码 4.1 本地模型 4.2 使用第三方的Embedding模型API

herosunly的博客 17万+

YOLOv11全网首发:注意力独家魔改 | 具有切片操作的SimAM注意力,魔改SimAM助力小目标检测

1)直接作为注意力使用,效果秒杀SimAM;2)高效和卷积结合,代替原始网络的卷积操作;

①答疑群聊服务;②YOLO大模型知识问答系统;③计算机视觉论文生成智能体; 1574

9.16华为OD机试真题 新系统 - 统计特殊数字 (Java/Py/C/C++/Js/Go)

9.16华为OD机试真题 新系统 - 统计特殊数字 (Java/Py/C/C++/Js/Go)

算法大师! 764

ssm框架搭建

这个是一个在idea上成功跑起来的ssm框架项目,保存在这里方便以后使用直接下载

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

上一篇: 10年开发码农带你理解MySQL——架构与概念&索引与优化
下一篇: 基于Docker + Consul + Registrator的服务注册与发现集群搭建
爱玛士
博客等级 码龄7年 719粉丝 253原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值