Docker 一小时从入门到实战 —— Docker commands | Create your own image | vs VM ... 基本概念扫盲

Docker crash course

1. What and Why of Docker?

2.1 What

image-20240131232702960

2.2 What problem does it solve?

2.2.1 before containers

Development process before containers? If your app uses 10 services, each developer needs to install these 10 services.

image-20240131232953257

Development process:

image-20240131234204271

  • Installations and configurations done directly on server’s OS
  • Dependency version conflicts etc.
  • image-20240131234503249

2.1.2 with containers

Development process with containers? Standardizes process of running any services on any local dev environment.

image-20240131233322529

image-20240131233809511

Development process:

  • Install Docker runtime on the server
  • Run Docker command to fetch and run Docker artifacts.

image-20240131234657955

2. Docker vs Virtual Machines

image-20240201222936730

2.1 Difference

image-20240201223239644

docker

  • contains the OS application layer - vertualize complete OS
  • services and apps installed on top that layer

image-20240201223642154

image-20240201223903860

2.2 Benefits

image-20240201224514428

image-20240201225004644

  • most containers are Linux based
  • Originally built for Linux OS

upgrade –

image-20240201225248641

image-20240201225439201

3. Install docker locally

image-20240201225835186

image-20240201225945915

4. Images vs Containers

image-20240202174026601

image-20240202174304374

image-20240202174335917

	docker images
	docker ps = list running contaniers 

5. Public and Private Registries

How do we get these images?

image-20240202175312917

image-20240202175753612

image-20240202191255815

6. Main Docker commands - pull,run,start,stop,logs,build

6.1 pull & run

Pull Docker Hub registry (docker.io) is used by default.

	docker pull {name}:{tag} = Pull an image from a registry
	docker images

Run

	docker run {name}:{tag} = creates a container from given images and starts it
	docker ps
  • docker generates a random name for the container automatically if you don’t specify one
  • docker pulls image automatically, if it doesn’t find it locally.
	docker -d = runs container in background and prints the container ID

you may still want to see the logs,which can be useful for debugging etc.

	docker logs {container} = view logs from service running inside the container.

give a name --name

docker run --name web-app -d -p 9000:80 nginx:1.23

Port Binding

image-20240202201259784

image-20240202201341689

localhost:80 cannot be reached

image-20240202201434320

only run with additional tag:

image-20240202201657337

image-20240202203541008

	docker stop {container} = stop one or more running containers
	-p or --publish = pubish a container's port to the host
	-p {HOST_PORT}:{CONTAINER_PORT}

all in all

	docker run -d -p 9000:80 niginx:1.23

image-20240202230203135

image-20240203180806189

6.2 start & stop

image-20240203180858684

docker ps only list the running containers. To list all containers (stopped and running) by using flag -a or --all

docker ps -a

stop

docker stop {containerID}

start

docker start {containerID} = start one or more stopped containers

logs

docker logs {containerID/NAME}

7. Public and private Docker registries

image-20240203225855787

image-20240203234521430

8. Registry vs Repository

image-20240203235721998

image-20240204000022806

image-20240204000125110

9. Create own image (Dockerfile)

image-20240205165439067

image-20240205165757421

9.1 Dockerfile - Build instruction

image-20240205165827894

image-20240205165844694

image-20240205165913517

image-20240205171226680

image-20240205171323341

image-20240205171445885

image-20240205210256610

image-20240205210713734

image-20240205211146261

image-20240205211320662

image-20240205211412241

	CMD ["node", "server.js"]

image-20240205211619780

9.2 Build image

	docker build {path} = Builds a Docker image from a Dockerfile

Sets a name and optionally a tag in the “name:tag” format

	docker build -t node-app:1.0 .

image-20240205214951661

image-20240205215035997

9.3 Run as Docker container

image-20240205215254016

9.4 Docker UI Client

10. Image Versioning

image-20240202191521178

“latest” tag mostly refers to the newest release.

11. Docker Compose

12. Docker Workflow Big Picture

How Docker fits in the complete development and development process?

image-20240205221128201

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/373611.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

微信小程序(三十四)搜索框-带历史记录

注释很详细&#xff0c;直接上代码 新增内容&#xff1a; 1.搜索框基本模板 2.历史记录基本模板 3.细节处理 源码&#xff1a; index.wxml <!-- 1.点击搜索按钮a.非空判断b.历史记录&#xff08;去重&#xff09;c.清空搜索框d.去除前后多余空格2.删除搜索 3.无搜索记录不…

springboot158基于springboot的医院资源管理系统

简介 【毕设源码推荐 javaweb 项目】基于springbootvue 的 适用于计算机类毕业设计&#xff0c;课程设计参考与学习用途。仅供学习参考&#xff0c; 不得用于商业或者非法用途&#xff0c;否则&#xff0c;一切后果请用户自负。 看运行截图看 第五章 第四章 获取资料方式 **项…

HTTP相关问题

目录 1.从输入URL到页面展示到底发生了什么&#xff1f; 2.HTTP状态码有哪些&#xff1f; 2.1 2XX(成功状态码) 2.2 3XX(重定向状态码) 2.3 4XX(客户端错误状态码) 2.4 5XX(服务端错误状态码) 3.HTTP 请求头中常见的字段有哪些&#xff1f; 4.HTTP和HTTPS有什么区别&…

[C++] 如何使用Visual Studio 2022 + QT6创建桌面应用

安装Visual Studio 2022和C环境 [Visual Studio] 基础教程 - Window10下如何安装VS 2022社区版_visual studio 2022 社区版-CSDN博客 安装QT6开源版 下载开源版本QT Try Qt | 开发应用程序和嵌入式系统 | Qt Open Source Development | Open Source License | Qt 下载完成&…

AI人工智能怎么自动抠图去除背景

抠图在许多场合中都发挥着重要的作用&#xff0c;它可以帮助我们去除图片的背景&#xff0c;从而将图片转换成透明底色&#xff0c;方便我们为图片更换其他的背景。为了实现照片去除背景只提取人物&#xff0c;我们需要使用专业的图片处理工具&#xff0c;并进行一系列的操作。…

算法效率的度量-时间空间复杂度

常对幂指阶 1.时间复杂度 事前预估 算法 时间开销 T(n) 与 问题规模 n 的关系&#xff08; T 表示 “ time ”&#xff09; 一般默认问题规模为n。 1.单循环 2.嵌套两层循环都为n 3.单层循环指数递增型 4.搜索型 链接 &#xff1a;第七章查找算法&#xff01;&#xff01…

elementUI 表格中如何合并动态数据的单元格

elementUI 表格中如何合并动态数据的单元格 ui中提供的案例是固定写法无法满足 实际开发需求 下面进行改造如下 准备数据如下 //在表格中 设置单元格的方法 :span-method"spanMethodFun" <el-table :data"tableData" border :span-method"spa…

2024第八届生物饲料高质量发展论坛会议通知

饲料工业发展空间大&#xff0c;产量持续增长&#xff0c;品质与质量也在不断提高&#xff0c;饲料工业是支撑现代畜牧水产养殖业发展的基础产业&#xff0c;是关系到城乡居民动物性食品供应的民生产业。“十四五”时期是我国由全面建设小康社会向基本实现社会主义现代化迈进的…

LeetCode、790. 多米诺和托米诺平铺【中等,二维DP,可转一维】

文章目录 前言LeetCode、790. 多米诺和托米诺平铺【中等&#xff0c;二维DP&#xff0c;可转一维】题目与分类思路二维解法二维转一维 资料获取 前言 博主介绍&#xff1a;✌目前全网粉丝2W&#xff0c;csdn博客专家、Java领域优质创作者&#xff0c;博客之星、阿里云平台优质…

性能测试工具LoadRunner与登录性能测试分析

1. LoadRunner与Jmeter Jmeter是开源免费的&#xff0c;LoadRunner是商业收费的。 但是LoadRunner具有非常强大的录制功能&#xff0c;具有丰富且灵活的场景&#xff0c;具备丰富的报告性能。 1&#xff09;Jmeter没有录制功能 2&#xff09;LoadRunner可以设计非常丰富的测试…

构造回文数组

目录 原题描述&#xff1a; 题目描述 时间&#xff1a;1s 空间&#xff1a;256M 题目描述&#xff1a; 输入格式&#xff1a; 输出格式&#xff1a; 样例1输入&#xff1a; 样例1输出&#xff1a; 样例2输入&#xff1a; 样例2输出&#xff1a; 约定&#xff1a; 作…

JVM 性能调优 - JVM 参数基础(2)

查看 JDK 版本 $ java -version java version "1.8.0_151" Java(TM) SE Runtime Environment (build 1.8.0_151-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode) 查看 Java 帮助文档 $ java -help 用法: java [-options] class [args...] …

CSS:三列布局

三列布局是指左右两列定宽&#xff0c;中间自适应。最终效果如下&#xff1a; HTML&#xff1a; <div class"container"><div class"left"></div><div class"center"></div><div class"right">…

javaEE - 23( 21000 字 Servlet 入门 -1 )

一&#xff1a;Servlet 1.1 Servlet 是什么 Servlet 是一种实现动态页面的技术. 是一组 Tomcat 提供给程序猿的 API, 帮助程序猿简单高效的开发一个 web app. 构建动态页面的技术有很多, 每种语言都有一些相关的库/框架来做这件事&#xff0c;Servlet 就是 Tomcat 这个 HTTP…

404. Sum of Left Leaves(左叶子之和)

问题描述 给定二叉树的根节点 root &#xff0c;返回所有左叶子之和。 问题分析 我们可以查看如果一个叶子是左叶子就加上其值然后返回&#xff0c;如果是右叶子则不用关。 代码 int sumOfLeftLeaves(struct TreeNode* root) {int sum 0;if(root!NULL){if(root->left!…

板块零 IDEA编译器基础:第二节 创建JAVA WEB项目与IDEA基本设置 来自【汤米尼克的JAVAEE全套教程专栏】

板块零 IDEA编译器基础&#xff1a;第二节 创建JAVA WEB项目与IDEA基本设置 一、创建JAVA WEB项目&#xff08;1&#xff09;普通项目升级成WEB项目&#xff08;2&#xff09;创建JAVA包 二、IDEA 开荒基本设置&#xff08;1&#xff09;设置字体字号自动缩放 &#xff08;2&am…

安全SCDN有什么作用

当前网络安全形势日益严峻&#xff0c;网络攻击事件频发&#xff0c;攻击手段不断升级&#xff0c;给企业和个人带来了严重的安全威胁。在这种背景下&#xff0c;安全SCDN作为一种网络安全解决方案&#xff0c;受到了广泛的关注。那么&#xff0c;安全SCDN真的可以应对网络攻击…

为后端做准备

这里写目录标题 flask 文件上传与接收flask应答&#xff08;接收请求&#xff08;文件、数据&#xff09;flask请求&#xff08;上传文件&#xff09;传递参数和文件 argparse 不从命令行调用参数1、设置default值2、"从命令行传入的参数".split()3、[--input,内容] …

基于OpenCV灰度图像转GCode的斜向扫描实现

基于OpenCV灰度图像转GCode的斜向扫描实现基于OpenCV灰度图像转GCode的斜向扫描实现 引言激光雕刻简介OpenCV简介实现步骤 1.导入必要的库2. 读取灰度图像3. 图像预处理4. 生成GCode5. 保存生成的GCode6. 灰度图像斜向扫描代码示例 总结 系列文章 ⭐深入理解G0和G1指令&…

003集—三调数据库添加三大类字段——arcgis

在国土管理日常统计工作中经常需要用到三大类数据&#xff08;农用地、建设用地、未利用地&#xff09;&#xff0c;而三调数据库中无三大类字段&#xff0c;因此需要手工录入三大类字段&#xff0c;并根据二级地类代码录入相关三大类名称。本代码可一键录入海量三大类名称统计…
最新文章