Docker(二) 镜像
简介
Docker镜像是什么?
它是一个只读的文件,就类似于我们安装操作系统时候所需要的那个iso光盘镜像,通过运行这个镜像来完成各种应用的部署。
这里的镜像就是一个能被docker运行起来的一个程序。
查看镜像资源操作命令
docker image
Usage: docker image COMMAND
Manage images
Options:
--help Print usage
Commands:
build Build an image from a Dockerfile
history Show the history of an image
import Import the contents from a tarball to create a filesystem image
inspect Display detailed information on one or more images
load Load an image from a tar archive or STDIN
ls List images
prune Remove unused images
pull Pull an image or a repository from a registry
push Push an image or a repository to a registry
rm Remove one or more images
save Save one or more images to a tar archive (streamed to STDOUT by default)
tag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
Run 'docker image COMMAND --help' for more information on a command.
搜索镜像资源
命令格式:docker search [image_name]
[root@VM_0_4_centos docker]# docker search nginx
INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED
docker.io docker.io/nginx Official build of Nginx. 12386 [OK]
docker.io docker.io/jwilder/nginx-proxy Automated Nginx reverse proxy for docker c... 1704 [OK]
docker.io docker.io/richarvey/nginx-php-fpm Container running Nginx + PHP-FPM capable ... 749 [OK]
docker.io docker.io/linuxserver/nginx An Nginx container, brought to you by Linu... 84
docker.io docker.io/bitnami/nginx Bitnami nginx Docker Image 73 [OK]
docker.io docker.io/tiangolo/nginx-rtmp Docker image with Nginx using the nginx-rt... 60 [
OFFICIAL [OK] 说明是官方提供的镜像
获取镜像
命令格式:docker pull [image_name]
拉取mysql镜像
[root@VM_0_4_centos docker]# docker pull docker.io/mysql
Using default tag: latest
Trying to pull repository docker.io/library/mysql ...
latest: Pulling from docker.io/library/mysql
d599a449871e: Pull complete
f287049d3170: Pull complete
08947732a1b0: Pull complete
96f3056887f2: Pull complete
871f7f65f017: Pull complete
1dd50c4b99cb: Pull complete
5bcbdf508448: Pull complete
a59dcbc3daa2: Pull complete
13e6809ab808: Pull complete
2148d51b084d: Pull complete
93982f7293d7: Pull complete
e736330a6d9c: Pull complete
Digest: sha256:c93ba1bafd65888947f5cd8bd45deb7b996885ec2a16c574c530c389335e9169
Status: Downloaded newer image for docker.io/mysql:latest
查看本地镜像
命令格式:docker image ls
命令格式:docker image
删除镜像资源
命令格式:docker image rm [image_id/image_name:image_version]
命令格式:docker rmi [image_id/image_name:image_version]
镜像重命名
docker tag [old_image]:[old_version] [new_image]:[new_version]
[root@VM_0_4_centos docker]# docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/mysql latest d435eee2caa5 4 weeks ago 456 MB
[root@VM_0_4_centos docker]# docker tag docker.io/mysql:latest my_mysql:1.0
[root@VM_0_4_centos docker]# docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/mysql latest d435eee2caa5 4 weeks ago 456 MB
my_mysql 1.0 d435eee2caa5 4 weeks ago 456 MB
导出镜像
将已经下载好的镜像,导出到本地,以备后用
命令格式:docker save -o [包文件] [镜像]
命令格式:docker save [镜像1] ... [镜像n] > [包文件]
docker save docker.io/mysql > mysql.tar
导入镜像
命令格式:docker load < [image.tar_name]
命令格式:docker load --input [image.tar_name]
docker load < mysql.tar
Docker(二) 镜像的更多相关文章
- 生产环境项目问题记录系列(二):Docker打包镜像Nuget包因权限问题还原失败
docker打包镜像遇到一个因为nuget权限验证问题导致镜像打包失败的问题,公司Nuget包用的是tfs管理的,tfs有权限验证,结果导致nuget还原失败,原有的NuGet.config文件如下: ...
- Docker:镜像操作和容器操作
镜像操作 列出镜像: $ sudo docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE hello-world latest 0a6b ...
- 使用Nexus3构建Docker私有镜像仓库
一.安装Nexus3 Nexus3是Sonatype提供的仓库管理平台,Nuexus Repository OSS3能够支持Maven.npm.Docker.YUM.Helm等格式数据的存储和发布:并 ...
- Docker常用镜像
Docker,具有快捷方便的特性,机器上不需要安装软件和进行各种配置,拉取镜像,一行命令即可启动服务,不使用时,一行命令关闭容器即可,快捷方便,干净.利索.建议将本地的redis.mysql.kafk ...
- docker(三) 镜像和容器常用命令
一.镜像操作 1.搜索镜像 可以直接在Docker Hub 直接搜索镜像,当然也可以使用命令来搜索. docker search 名称 docker search tomcat 2.拉取镜像 dock ...
- docker 拷贝镜像文件
1.概述 我们制作好镜像后,有时需要将镜像复制到另一台服务器使用. 能达到以上目的有两种方式,一种是上传镜像到仓库中(本地或公共仓库),但是另一台服务器很肯能只是与当前服务器局域网想通而没有公网的,所 ...
- Docker搭建镜像仓库和配置缓冲地点
Docker搭建镜像仓库和配置缓冲地点 参考网址:https://docs.docker.com/engine/reference/commandline/dockerd/#options 一.配置D ...
- Docker dockerfile镜像编码
一. 大多数docker基础镜像使用locale查看编码,发现默认编码都是POSIX,这会导致中文乱码.解决方法如下: 二.首先使用locale -a查看容器所有语言环境 三.dockerfile中加 ...
- docker之镜像管理命令
一.docker image 镜像管理命令 指令 描述ls 列出本机镜像build 构建镜像来自Dockerfilehistory 查看镜像历史inspect 显示一个或多个镜像详细信息pull 从镜 ...
随机推荐
- Sybase commands
(1)update table statistics $table name if we change index info for a table ,such as create or drop i ...
- [译文] C# 已成旧闻, 向前, 抵达 C# 9!
C# 8 is old news. Onward, to C# 9! (C# 已成旧闻, 向前, 抵达 C# 9!) Did you know that planning is already und ...
- TCP/IP||Ping
1.what's PING 由Mike Muuss编写,为了测试另一台主机是否可达,发送一份ICMP回显请求报文给主机,并等待返回ICMP回显应答,如果不能PING到某台主机,那么就不能Telnet或 ...
- .Net快速上手Nlog日志组件
目录 一.NLog 简介 二.NLog 安装 三. NLog 配置 四.程序代码中写日志 五.参考 一.NLog 简介 NLog是适用于各种.NET平台的灵活,免费的日志记录平台.NLog使写入多个目 ...
- 十三、springboot 优雅集成spring-boot-admin 实现程序监控
前言 我们知道项目的监控是尤为重要的,但是我们如果用jdk 自带的jconsole 和jvisualvm 的话会非常繁琐,且界面不是很友好.之前我们使用了spring boot 项目,但是都没有对项目 ...
- 开发者请注意:Python2 的最后版本将于 4 月发布,但它确实是在 1 月 1 日就寿命终止了!
2020 年 1 月 1 日是 Python2 的寿命终止日,这个日期在两年前经"Python之父" Guido van Rossum 宣布,此后一直成为开发者社区翘首以盼的一天. ...
- 【转载】JavaScript术语:shim 和 polyfill
在学习和使用 JavaScript 的时候,我们会经常碰到两个术语:shim 和 polyfill.它们有许多定义和解释,意思相近又有差异. Shim Shim 指的是在一个旧的环境中模拟出一个新 A ...
- 前端模块化——彻底搞懂AMD、CMD、ESM和CommonJS
我们知道,在NodeJS之前,由于没有过于复杂的开发场景,前端是不存在模块化的,后端才有模块化.NodeJS诞生之后,它使用CommonJS的模块化规范.从此,js模块化开始快速发展. 模块化的开发方 ...
- 「学习笔记」ST表
问题引入 先让我们看一个简单的问题,有N个元素,Q次操作,每次操作需要求出一段区间内的最大/小值. 这就是著名的RMQ问题. RMQ问题的解法有很多,如线段树.单调队列(某些情况下).ST表等.这里主 ...
- 共识网络BFT-SMaRt:理论与实践
目录 BFT-SMaRt 简介 分布式计数器服务 功能描述 组网配置 启动节点 常见问题 计数服务 容错服务 BFT-SMaRt 理论 BFT-SMR 典型模式 SMR 状态机复制 VP-Consen ...