当前位置: 首页 > news >正文

Docker实例

华子目录

  • docker实例
    • 1.为Ubuntu镜像添加ssh服务
    • 2.Docker安装mysql

docker实例

1.为Ubuntu镜像添加ssh服务

(1)访问https://hub.docker.com,寻找合适的Ubuntu镜像
在这里插入图片描述
(2)拉取Ubuntu镜像

[root@server ~]# docker pull ubuntu:latest
latest: Pulling from library/ubuntu
7b1a6ab2e44d: Pull complete
Digest: sha256:626ffe58f6e7566e00254b638eb7e0f3b11d4da9675088f4781a50ae288f3322
Status: Downloaded newer image for ubuntu:latest
docker.io/library/ubuntu:latest[root@server ~]# docker images
REPOSITORY   TAG       IMAGE ID       CREATED       SIZE
ubuntu       latest    ba6acccedd29   2 years ago   72.8MB

(3)后台运行容器,并配置软件源

  • Ubuntu的软件源必须以.list结尾,并且软件源放在/etc/apt/
[root@server ~]# docker run -itd --name ubuntu -p 2222:22 ubuntu:latest
871fe7e0e9a3c0d3f5d079911483cb890323d2dfd3c13d23f685aa2dd4c75944
[root@server ~]# docker exec -it ubuntu bash
root@871fe7e0e9a3:/# mv /etc/apt/sources.list /etc/apt/sources.list.backup  #将原来的软件源置为备份root@871fe7e0e9a3:~# echo  deb https://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse  >>  /etc/apt/sources.list
root@871fe7e0e9a3:~# echo  deb-src https://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse  >>  /etc/apt/sources.list
root@871fe7e0e9a3:~# echo  deb https://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse  >>  /etc/apt/sources.list
root@871fe7e0e9a3:~# echo  deb-src https://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse  >>  /etc/apt/sources.list
root@871fe7e0e9a3:~# echo  deb https://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse  >>  /etc/apt/sources.list
root@871fe7e0e9a3:~# echo  deb-src https://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse  >>  /etc/apt/sources.list
root@871fe7e0e9a3:~# echo  deb https://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse  >>  /etc/apt/sources.list
root@871fe7e0e9a3:~# echo  deb-src https://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse  >>  /etc/apt/sources.listroot@871fe7e0e9a3:~# cd /etc/apt
root@871fe7e0e9a3:/etc/apt# ls
apt.conf.d  auth.conf.d  preferences.d  sources.list  sources.list.backup  sources.list.d  trusted.gpg.droot@871fe7e0e9a3:/etc/apt# apt update
Ign:1 https://mirrors.aliyun.com/ubuntu jammy InRelease
Ign:2 https://mirrors.aliyun.com/ubuntu jammy-security InRelease
Ign:3 https://mirrors.aliyun.com/ubuntu jammy-updates InRelease
Ign:4 https://mirrors.aliyun.com/ubuntu jammy-backports InRelease
Err:5 https://mirrors.aliyun.com/ubuntu jammy ReleaseCertificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.  Could not handshake: Error in the certificate verification. [IP: 182.40.60.234 443]
Err:6 https://mirrors.aliyun.com/ubuntu jammy-security ReleaseCertificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.  Could not handshake: Error in the certificate verification. [IP: 182.40.60.234 443]
Err:7 https://mirrors.aliyun.com/ubuntu jammy-updates ReleaseCertificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.  Could not handshake: Error in the certificate verification. [IP: 182.40.60.234 443]
Err:8 https://mirrors.aliyun.com/ubuntu jammy-backports ReleaseCertificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.  Could not handshake: Error in the certificate verification. [IP: 182.40.60.234 443]
Reading package lists... Done
W: https://mirrors.aliyun.com/ubuntu/dists/jammy/InRelease: No system certificates available. Try installing ca-certificates.
W: https://mirrors.aliyun.com/ubuntu/dists/jammy-security/InRelease: No system certificates available. Try installing ca-certificates.
W: https://mirrors.aliyun.com/ubuntu/dists/jammy-updates/InRelease: No system certificates available. Try installing ca-certificates.
W: https://mirrors.aliyun.com/ubuntu/dists/jammy-backports/InRelease: No system certificates available. Try installing ca-certificates.
W: https://mirrors.aliyun.com/ubuntu/dists/jammy/Release: No system certificates available. Try installing ca-certificates.
E: The repository 'https://mirrors.aliyun.com/ubuntu jammy Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: https://mirrors.aliyun.com/ubuntu/dists/jammy-security/Release: No system certificates available. Try installing ca-certificates.
E: The repository 'https://mirrors.aliyun.com/ubuntu jammy-security Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: https://mirrors.aliyun.com/ubuntu/dists/jammy-updates/Release: No system certificates available. Try installing ca-certificates.
E: The repository 'https://mirrors.aliyun.com/ubuntu jammy-updates Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: https://mirrors.aliyun.com/ubuntu/dists/jammy-backports/Release: No system certificates available. Try installing ca-certificates.
E: The repository 'https://mirrors.aliyun.com/ubuntu jammy-backports Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

(4)安装和配置ssh服务

root@871fe7e0e9a3:~# apt install openssh-server -y

(5)如果需要正常启动ssh服务,则目录/var/run/sshd必须存在

root@871fe7e0e9a3:~# mkdir -p /var/run/sshd

(6)启动ssh服务,并查看监听状态

root@871fe7e0e9a3:~# /usr/sbin/sshd -D &
root@871fe7e0e9a3:~# apt install iproute
root@871fe7e0e9a3:~# ss -lntup

(7)使用ssh连接容器

[root@node1 ~]# ssh root@192.168.80.129 -p 2222

2.Docker安装mysql

(1)访问https://hub.docker.com,寻找合适的mysql镜像
在这里插入图片描述
(2)拉取mysql镜像

[root@server ~]# docker pull mysql:latest
latest: Pulling from library/mysql
72a69066d2fe: Pull complete
93619dbc5b36: Pull complete
99da31dd6142: Pull complete
626033c43d70: Pull complete
37d5d7efb64e: Pull complete
ac563158d721: Pull complete
d2ba16033dad: Pull complete
688ba7d5c01a: Pull complete
00e060b6d11d: Pull complete
1c04857f594f: Pull complete
4d7cfa90e6ea: Pull complete
e0431212d27d: Pull complete
Digest: sha256:e9027fe4d91c0153429607251656806cc784e914937271037f7738bd5b8e7709
Status: Downloaded newer image for mysql:latest
docker.io/library/mysql:latest[root@server ~]# docker images
REPOSITORY   TAG       IMAGE ID       CREATED       SIZE
mysql        latest    3218b38490ce   2 years ago   516MB
ubuntu       latest    ba6acccedd29   2 years ago   72.8MB

(3)后台运行容器,并使用exec进入容器

  • mariadbMySQL指定-e变量时都是MYSQL_ROOT_PASSWORD
[root@server ~]# docker run -itd --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql:latest
ea6beb680b7ae725d844bd3360e184e772bbbadc9df1e84f10a90b60a9625c52
[root@server ~]# docker ps
CONTAINER ID   IMAGE           COMMAND                   CREATED          STATUS          PORTSNAMES
ea6beb680b7a   mysql:latest    "docker-entrypoint.s…"   15 seconds ago   Up 14 seconds   0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp   mysql
871fe7e0e9a3   ubuntu:latest   "bash"                    44 minutes ago   Up 44 minutesubuntu
[root@server ~]# docker exec -it mysql bash
root@ea6beb680b7a:/# mysql -uroot -p123456
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.27 MySQL Community Server - GPLCopyright (c) 2000, 2021, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>

相关文章:

Docker实例

华子目录 docker实例1.为Ubuntu镜像添加ssh服务2.Docker安装mysql docker实例 1.为Ubuntu镜像添加ssh服务 (1)访问https://hub.docker.com,寻找合适的Ubuntu镜像 (2)拉取Ubuntu镜像 [rootserver ~]# docker pull ubuntu:latest latest: Pulling from library/ub…...

python基础——模块【模块的介绍,模块的导入,自定义模块,*和__all__,__name__和__main__】

📝前言: 这篇文章主要讲解一下python基础中的关于模块的导入: 1,模块的介绍 2,模块的导入方式 3,自定义模块 🎬个人简介:努力学习ing 📋个人专栏:C语言入门基…...

【HTML】标签学习(下.2)

(大家好哇,今天我们将继续来学习HTML(下.2)的相关知识,大家可以在评论区进行互动答疑哦~加油!💕) 目录 二.列表标签 2.1 无序列表(重点) 2.2有序列表(理解) 2.3 自定义列表(重点…...

os模块篇(十一)

文章目录 os.chdir(path)os.chmod(path, mode, *, dir_fdNone, follow_symlinksTrue)os.chown(path, uid, gid, *, dir_fdNone, follow_symlinksTrue)os.getcwd()os.getcwdb()os.lchflags(path, flags)os.lchmod(path, mode)os.lchown(path, uid, gid) os.chdir(path) os.chdi…...

编译amd 的 amdgpu 编译器

1,下载源码 git clone --recursive https://github.com/ROCm/llvm-project.git 2, 配置cmake cmake -G "Unix Makefiles" ../llvm \ -DLLVM_ENABLE_PROJECTS"clang;clang-tools-extra;compiler-rt" \ -DLLVM_BUILD_EXAMPLESON …...

github 多个账号共享ssh key 的设置方法

确认本机是否已有ssh key 首先确认自己系统内有没有 ssh key。 bash复制代码cd ~/.ssh ls *.pub # 列出所有公钥文件id_rsa.pub若有,确认使用当前 key 或者生成新 key,若没有,生成新 key。由于我需要登录两个帐号,所以在已经存在…...

dm8修改sysdba用户的密码

1 查看达梦数据库版本 SQL> select * from v$version;LINEID BANNER ---------- --------------------------------- 1 DM Database Server 64 V8 2 DB Version: 0x7000c 3 03134283904-20220630-163817-200052 …...

基于boost准标准库的搜索引擎项目

零 项目背景/原理/技术栈 1.介绍boost准标准库 2.项目实现效果 3.搜索引擎宏观架构图 这是一个基于Web的搜索服务架构 客户端-服务器模型:采用了经典的客户端-服务器模型,用户通过客户端与服务器交互,有助于集中管理和分散计算。简单的用户…...

语言模型进化史(下)

由于篇幅原因,本文分为上下两篇,上篇主要讲解语言模型从朴素语言模型到基于神经网络的语言模型,下篇主要讲解现代大语言模型以及基于指令微调的LLM。文章来源是:https://www.numind.ai/blog/what-are-large-language-models 四、现…...

设计模式之旅:工厂模式全方位解析

简介 设计模式中与工厂模式相关的主要有三种,它们分别是: 简单工厂模式(Simple Factory):这不是GoF(四人帮,设计模式的开创者)定义的标准模式,但被广泛认为是工厂模式的…...

大数据时代的生物信息学:挖掘生命数据,揭示生命奥秘

在当今科技日新月异的时代,大数据如同一座蕴藏无尽宝藏的矿山,而生物信息学则是那把锐利的探矿锤,精准有力地敲击着这座“生命之矿”,揭示出隐藏在其深处的生命奥秘。随着基因测序技术的飞速进步与广泛应用,生物医学领…...

微信小程序开发【从入门到精通】——页面导航

👨‍💻个人主页:开发者-曼亿点 👨‍💻 hallo 欢迎 点赞👍 收藏⭐ 留言📝 加关注✅! 👨‍💻 本文由 曼亿点 原创 👨‍💻 收录于专栏&#xff1a…...

嵌入式|蓝桥杯STM32G431(HAL库开发)——CT117E学习笔记15:PWM输出

系列文章目录 嵌入式|蓝桥杯STM32G431(HAL库开发)——CT117E学习笔记01:赛事介绍与硬件平台 嵌入式|蓝桥杯STM32G431(HAL库开发)——CT117E学习笔记02:开发环境安装 嵌入式|蓝桥杯STM32G431(…...

SQLite中的隔离(八)

返回:SQLite—系列文章目录 上一篇:SQLite版本3中的文件锁定和并发(七) 下一篇:SQLite 查询优化器概述(九) 数据库的“isolation”属性确定何时对 一个操作的数据库对其他并发操作可见。 数据库连接之…...

Zabbix6 - Centos7部署Grafana可视化图形监控系统配置手册手册

Zabbix6 - Centos7部署Grafana可视化图形监控系统配置手册手册 概述: Grafana是一个开源的数据可视化和监控平台。其特点: 1)丰富的可视化显示插件,包括热图、折线图、饼图,表格等; 2)支持多数据…...

Electron无边框自定义窗口拖动

最近使用了electron框架,发现如果自定义拖动是比较实用的;特别是定制化比较高的项目,如果单纯的使用-webkit-app-region: drag;会让鼠标事件无法触发; 过程中发现问题: 1.windows缩放不是100%后设置偏移界面会缩放,感觉像吹起的气…...

vue3+echarts:echarts地图打点显示的样式

colorStops是打点的颜色和呼吸灯、label为show是打点是否显示数据、rich里cnNum是自定义的过滤模板用来改写显示数据的样式 series: [{type: "effectScatter",coordinateSystem: "geo",rippleEffect: {brushType: "stroke",},showEffectOn: &quo…...

vue3从精通到入门7:ref系列

Vue 3 的 Ref 是一个集合,包括多个与响应式引用相关的功能,这些功能共同构成了 Vue 3 响应式系统的重要组成部分。以下是更全面的介绍: 1.ref ref 接受一个内部值并返回一个响应式且可变的 ref 对象。这个对象具有一个 .value 属性&#xf…...

灵动翻译音频文件字幕提取及翻译;剪映视频添加字幕

参考:视频音频下载工具 https://tuberipper.com/21/save/mp3 1、灵动翻译音频文件字幕提取及翻译 灵动翻译可以直接chorme浏览器插件安装: 点击使用,可以上传音频文件 上传后自动翻译,然后点击译文即可翻译成中文,…...

在Gitee上创建新仓库

1. 登录到你的Gitee账户。 2. 在Gitee首页或仓库页面,点击“新建仓库”按钮。 3. 填写仓库名称、描述(可选)、选择仓库是否公开等信息。 4. 点击“创建仓库”按钮完成创建。 2. 本地代码连接到远程仓库 假设你已经在本地有一个项目&#…...

深度学习在微纳光子学中的应用

深度学习在微纳光子学中的主要应用方向 深度学习与微纳光子学的结合主要集中在以下几个方向: 逆向设计 通过神经网络快速预测微纳结构的光学响应,替代传统耗时的数值模拟方法。例如设计超表面、光子晶体等结构。 特征提取与优化 从复杂的光学数据中自…...

C++初阶-list的底层

目录 1.std::list实现的所有代码 2.list的简单介绍 2.1实现list的类 2.2_list_iterator的实现 2.2.1_list_iterator实现的原因和好处 2.2.2_list_iterator实现 2.3_list_node的实现 2.3.1. 避免递归的模板依赖 2.3.2. 内存布局一致性 2.3.3. 类型安全的替代方案 2.3.…...

(二)TensorRT-LLM | 模型导出(v0.20.0rc3)

0. 概述 上一节 对安装和使用有个基本介绍。根据这个 issue 的描述,后续 TensorRT-LLM 团队可能更专注于更新和维护 pytorch backend。但 tensorrt backend 作为先前一直开发的工作,其中包含了大量可以学习的地方。本文主要看看它导出模型的部分&#x…...

macOS多出来了:Google云端硬盘、YouTube、表格、幻灯片、Gmail、Google文档等应用

文章目录 问题现象问题原因解决办法 问题现象 macOS启动台(Launchpad)多出来了:Google云端硬盘、YouTube、表格、幻灯片、Gmail、Google文档等应用。 问题原因 很明显,都是Google家的办公全家桶。这些应用并不是通过独立安装的…...

生成 Git SSH 证书

🔑 1. ​​生成 SSH 密钥对​​ 在终端(Windows 使用 Git Bash,Mac/Linux 使用 Terminal)执行命令: ssh-keygen -t rsa -b 4096 -C "your_emailexample.com" ​​参数说明​​: -t rsa&#x…...

视频字幕质量评估的大规模细粒度基准

大家读完觉得有帮助记得关注和点赞!!! 摘要 视频字幕在文本到视频生成任务中起着至关重要的作用,因为它们的质量直接影响所生成视频的语义连贯性和视觉保真度。尽管大型视觉-语言模型(VLMs)在字幕生成方面…...

算法笔记2

1.字符串拼接最好用StringBuilder&#xff0c;不用String 2.创建List<>类型的数组并创建内存 List arr[] new ArrayList[26]; Arrays.setAll(arr, i -> new ArrayList<>()); 3.去掉首尾空格...

sipsak:SIP瑞士军刀!全参数详细教程!Kali Linux教程!

简介 sipsak 是一个面向会话初始协议 (SIP) 应用程序开发人员和管理员的小型命令行工具。它可以用于对 SIP 应用程序和设备进行一些简单的测试。 sipsak 是一款 SIP 压力和诊断实用程序。它通过 sip-uri 向服务器发送 SIP 请求&#xff0c;并检查收到的响应。它以以下模式之一…...

Aspose.PDF 限制绕过方案:Java 字节码技术实战分享(仅供学习)

Aspose.PDF 限制绕过方案&#xff1a;Java 字节码技术实战分享&#xff08;仅供学习&#xff09; 一、Aspose.PDF 简介二、说明&#xff08;⚠️仅供学习与研究使用&#xff09;三、技术流程总览四、准备工作1. 下载 Jar 包2. Maven 项目依赖配置 五、字节码修改实现代码&#…...

Redis:现代应用开发的高效内存数据存储利器

一、Redis的起源与发展 Redis最初由意大利程序员Salvatore Sanfilippo在2009年开发&#xff0c;其初衷是为了满足他自己的一个项目需求&#xff0c;即需要一个高性能的键值存储系统来解决传统数据库在高并发场景下的性能瓶颈。随着项目的开源&#xff0c;Redis凭借其简单易用、…...