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 从镜 ...
随机推荐
- F4与F1对比
- 19.python基础试题(三)
转载: 老男孩 Python 基础知识练习(三):https://www.cnblogs.com/nulige/p/6128674.html 1.列举布尔值为 False 的值空,None,0, Fa ...
- 给你的 ASP.NET Core 程序插上 Feature Flag 的翅膀
前言 我们知道,目前大多数应用程序在正式发布到生产环境之前都会经历多个不同的测试环境,通过让应用程序在多个不同的环境中运行来及时发现并解决问题,避免在线上发生不必要的损失.这是对于整个软件的发布流程来 ...
- 【题解】Vijos1404 遭遇战(最短路图论套路)
[题解]Vijos1404 遭遇战(最短路图论套路) 感觉一定要有建模的思想,不管什么东西要抽象建模之后再用算法解决... 求最短代价就可能可以用最短路,这句话不是强行解释,而是因为图论建模过后,可能 ...
- 【合集】有标号的DAG图计数(合集)
[合集]有标号的DAG图计数(合集) orz 1tst [题解]有标号的DAG计数1 [题解]有标号的DAG计数2 [题解]有标号的DAG计数3 [题解]有标号的DAG计数4
- $[NOIp2017]$ 宝藏 状压$dp$
\(Sol\) 觉得这里是个很巧妙的地方吖,就是记下当前扩展点集的最大深度,然后强制下一步扩展的点集都是最大深度+1.这样做在当前看可能会导致误算答案导致答案偏大,但是整个\(dp\)完成后一定可以得 ...
- $SP703\ Mobile\ Service\ DP$
洛谷 Sol 首先状态是已经完成的请求数量 这题只有三个员工跑来跑去,只有三个.... 一般像这种人数特别少的DP题就会把它们都放到状态里去 于是:f[i][x][y][z]表示现在已经完成了i个请求 ...
- POJ 2318 TOYS(叉积+二分)
题目传送门:POJ 2318 TOYS Description Calculate the number of toys that land in each bin of a partitioned ...
- sqlserver 存储过程调Api接口
--开启Sql Server 通讯配置-- sp_configure ; GO RECONFIGURE; GO sp_configure ; GO RECONFIGURE; GO EXEC sp_co ...
- ArcGIS Server 动态图层发布调用图解
目录 1 前言 1.1 简介 1.2 适用场景 2 动态图层 2.1 共享地图服务 2.2 动态工作空间添加 2.2.1 企业级数据库 2.2.2 shapefile文件夹 2.2.3 栅格文件夹 2 ...