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 从镜 ...
随机推荐
- IPv4数据报格式及其语义
一.IP数据报的格式如下图所示 版本 首部长度 服务类型 数据报长度 16比特标识 标志 13比特片偏移 寿命 上层协议 首部检验和 32比特源IP地址 32比特目的IP地址 选项(如果有的话) 数据 ...
- git之github推送篇
1.创建项目 2.生成ssh密钥并设置到github 在文件夹里面右键打开git命令行,输入下面命令,然后一直回车. ssh-keygen -t rsa 生成位置在当前用户的.ssh文件夹里,带pu ...
- 【温故知新】Java web 开发(四)JSTL 与 JDBC 的增删改查
本篇开始使用 jstl 这个 jsp 的标签库,在同一个 Servlet 中实现处理 CRUD 请求,以及使用 jdbc 数据库基本操作.然后你会发现 Servlet 和 jdbc 还是有很多不方便之 ...
- 【简要题解】Hihocoder 重复旋律1-9简要题解
[简要题解]Hihocoder 重复旋律1-8简要题解 编号 名称标签 难度 1403 后缀数组一·重复旋律 Lv.4 1407 后缀数组二·重复旋律2 Lv.4 1415 后缀数组三·重复旋律3 L ...
- centos 7.3 服务器环境搭建——MySQL 安装和配置
centos 7.3 服务器环境搭建——MySQL 安装和配置服务器信息如下:服务器:阿里云系统 centos 7.3 (阿里云该版本最新系统)mysql版本:5.7.18 (当前时间最新版本)连接服 ...
- Educational Codeforces Round 53 (Rated for Div. 2) (前五题题解)
这场比赛没有打,后来补了一下,第五题数位dp好不容易才搞出来(我太菜啊). 比赛传送门:http://codeforces.com/contest/1073 A. Diverse Substring ...
- Django之models字段属性
目录 常用字段 AutoField IntegerField CharField 自定义及使用char DateField DateTimeField 字段合集 字段参数 null unique db ...
- 量化投资学习笔记07——python知识补漏
看<量化投资:以python为工具>这本书,第一部分是python的基础知识.这一部分略读了,只看我还不知道或不熟的. 定义复数 x = complex(2, 5) #2+5j 也可以直接 ...
- zTree 节点勾选取消勾选 选中取消选中
zTreeObj.cancelSelectedNode function 举例 取消当前所有被选中节点的选中状态 var treeObj = $.fn.zTree.getZTreeObj(" ...
- 不只是安装,Kolla 让 OpenStack 运维变简单
使用 kolla 部署的 OpenStack 环境和传统直接安装的环境相比较,因为使用了全容器化部署,基本操作上有很大不同.对于初学者,操作变得更清晰和更简单了,但是如果你已经有了一定的经验,可能反而 ...