关键词:
本地镜像管理
docker images
: 列出本地镜像;docker rmi
:删除本地镜像;docker tag
:标记本地镜像;docker build
:使用DockerFile创建镜像;docker history
:查看指定镜像的创建历史;docker save
:将指定镜像保存成tar归档文件;docker load
:导入使用docker save
命令导出的镜像;docker import
:从归档文件中创建镜像;docker commit
:从容器修改中创建新的镜像;
列出本地镜像
语法如下:
docker images [OPTIONS] [REPOSITORY[:TAG]]
Options:
-a, --all Show all images (default hides intermediate images(默认隐藏中间镜像层))
--digests Show digests(显示摘要信息)
-f, --filter filter Filter output based on conditions provided(显示满足条件的镜像)
--format string Pretty-print images using a Go template
--help Print usage
--no-trunc Don‘t truncate output(显示完整的镜像信息)
-q, --quiet Only show numeric IDs
删除本地镜像
语法如下:
docker rmi [OPTIONS] IMAGE [IMAGE...]
Options:
-f, --force Force removal of the image(强制删除镜像)
--no-prune Do not delete untagged parents(不移除该镜像的过程镜像,默认移除)
例如:
# 删除所有镜像
docker rmi $(docker images -q)
# 批量删除无用镜像
docker rmi $(docker images -f dangling=true)
标记本地镜像
语法如下:
docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]
使用DockerFile创建镜像
语法如下:
docker build [OPTIONS] PATH | URL | -
Options:
--build-arg list Set build-time variables (default [])
--cache-from stringSlice Images to consider as cache sources
--cgroup-parent string Optional parent cgroup for the container
--compress Compress the build context using gzip
--cpu-period int Limit the CPU CFS (Completely Fair Scheduler) period
--cpu-quota int Limit the CPU CFS (Completely Fair Scheduler) quota
-c, --cpu-shares int CPU shares (relative weight)
--cpuset-cpus string CPUs in which to allow execution (0-3, 0,1)
--cpuset-mems string MEMs in which to allow execution (0-3, 0,1)
--disable-content-trust Skip image verification (default true)
-f, --file string Name of the Dockerfile (Default is ‘PATH/Dockerfile‘)
--force-rm Always remove intermediate containers
--help Print usage
--isolation string Container isolation technology
--label list Set metadata for an image (default [])
-m, --memory string Memory limit
--memory-swap string Swap limit equal to memory plus swap: ‘-1‘ to enable unlimited swap
--network string Set the networking mode for the RUN instructions during build (default "default")
--no-cache Do not use cache when building the image
--pull Always attempt to pull a newer version of the image
-q, --quiet Suppress the build output and print image ID on success
--rm Remove intermediate containers after a successful build (default true)
--security-opt stringSlice Security options
--shm-size string Size of /dev/shm, default value is 64MB
-t, --tag list Name and optionally a tag in the ‘name:tag‘ format (default [])
--ulimit ulimit Ulimit options (default [])
查看指定镜像的创建历史
语法如下:
docker history [OPTIONS] IMAGE
Options:
-H, --human Print sizes and dates in human readable format (default true)
--no-trunc Don‘t truncate output
-q, --quiet Only show numeric IDs
镜像保存
语法如下:
docker save [OPTIONS] IMAGE [IMAGE...]
Options:
-o, --output string Write to a file, instead of STDOUT
镜像导入
语法如下:
docker load [OPTIONS]
Options:
-i, --input string Read from tar archive file, instead of STDIN
-q, --quiet Suppress the load output
从归档文件中创建镜像
语法如下:
docker import [OPTIONS] file|URL|- [REPOSITORY[:TAG]]
Options:
-c, --change list Apply Dockerfile instruction to the created image (default [])
-m, --message string Set commit message for imported image
从容器修改中创建新镜像
语法如下:
docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]
Options:
-a, --author string Author (e.g., "John Hannibal Smith <hannibal@a-team.com>")
-c, --change list Apply Dockerfile instruction to the created image (default [])
-m, --message string Commit message
-p, --pause Pause container during commit (default true)
docker基础知识和命令使用入门(代码片段)
本文介绍了Docker相关的基础知识和命令的简单使用。基础知识部分包括Docker的用途和意义,Docker的镜像、容器、仓库、Dockerfile和DockerCompose的理解,以及Docker图形管理工具Portainer的基础功能。Docker命令的使用包括镜像使用、容器... 查看详情
docker进程镜像容器相关命令(代码片段)
DockerDocker命令1.1进程相关命令systemctlstartdocker#启动docker服务systemctlstopdocker#停止docker服务systemctlrestartdocker#重启docker服务systemctlstatusdocker#查看docker服务状态systemctlenabledocker#开机启动docker服务1.2镜像相关命令1、查看镜像:查看本地... 查看详情
003-docker的操作命令-远程镜像仓库命令,本地镜像管理命令(代码片段)
1、远程镜像仓库docker login/logout:查看 【不常用】docker push:查看 【不常用】docker search:从DockerHub查找镜像 语法:dockersearch[OPTIONS]TERM OPTIONS说明:--automated:只列出automatedbuild类型的镜像;--no-trunc:显示... 查看详情
docker命令集合(代码片段)
镜像相关构建镜像dockerbuild-t<imagename>.查看本地镜像dockerimages查询镜像dockersearchmysql5.7拉取镜像到本地dockerpullmysql5.7导出本地镜像dockersave<imagename>-oimage.tar导入镜像dockerload-iimage.tar删除本地镜像dockerrmiimages查看构建 查看详情
docker基础命令详解——镜像及容器操作(代码片段)
Docker基础命令详解——镜像及容器操作前言?上篇文章介绍了有关Docker的基础与Linux下docker的安装,本文主要讲解安装docker后的基础使用方法以及命令的介绍,主要是docker镜像操作及容器操作命令。?当然,docker的相关命令非常多... 查看详情
docker&kubernetes❀docker镜像与容器相关操作基础命令详解(代码片段)
文章目录1、Docker信息查询1.1版本信息1.2详细信息1.3帮助命令2、镜像命令2.1本地镜像查看2.2镜像搜索2.3镜像拉取2.4镜像删除3、容器命令3.1新建并启动容器3.2列出所有运行的容器3.3退出容器3.4启动/重启/停止/杀死/删除/重新登录容... 查看详情
6docker镜像相关操作命令(代码片段)
1、列出本地镜像[[email protected]~]#dockerimagesREPOSITORY:表示镜像仓库源(也就是镜像的名字)TAG:镜像的标签IMAGEID:镜像IDCREATED:镜像创建的时间VIRTUALSIZE:镜像大小同一镜像源可以有多个TAG,代表这个仓库的不同版本,docker中使用REPOSIT... 查看详情
2-docker命令(代码片段)
Docker服务相关命令:#启动docker服务systemctlstartdocker#停止docker服务systemctlstopdocker#重启docker服务systemctlrestartdocker#查看docker状态systemctlstatusdocker#开机启动docker服务systemctlenabledocker Docker镜像相关命令: 官方仓库... 查看详情
docker基础:镜像(代码片段)
...像删除镜像创建镜像导出和导入镜像上传镜像总结镜像是Docker的三大核心概念之一。Docker运行容器前需要本地存在对应的镜像,如果本地没有对应的镜像,Docker会尝试从默认的镜像仓库下载。当然用户也可以通过配置,使用自定... 查看详情
docker镜像管理基础与基于容器的镜像制作示例(代码片段)
一、Docker镜像 Docker镜像是启动Docker容器的一个非常重要的组件。Docker各组件之间的关系如图: Docker镜像含有启动容器所需要的文件系统及其内容,因此Docker镜像用于创建并启动容器。并且Docker镜像是采用分层构建,联合... 查看详情
docker常用的基础命令(代码片段)
docker常用的基础命令镜像命令:搜索镜像:dockersearchimages_name下载镜像:dockerpullimages_name查看当前的所有镜像:dockerimages删除本地镜像:dockerrmiimages_name容器操作:新建容器并启动:#在容器里启动一个/bin/bashshell环境,可以登录... 查看详情
docker命令详解(代码片段)
docker的使用命令1docker命令介绍docker--help管理命令:container管理容器image管理镜像network管理网络命令:attach介入到一个正在运行的容器build根据Dockerfile构建一个镜像commit根据容器的更改创建一个新的镜像cp在本地文件系统与容器中... 查看详情
docker基础命令(代码片段)
docker镜像操作dockerrunhello-world #运行hello-world镜像dockerclient客户端连接到了服务端(服务端是以一个守护进程的形式跑在操作系统里面的)restfulapi典型的C/s架构由docker服务端的守护进程从dockerhub上下载了镜像(服务端会先检查本地系... 查看详情
docker基础命令(代码片段)
docker镜像操作dockerrunhello-world #运行hello-world镜像dockerclient客户端连接到了服务端(服务端是以一个守护进程的形式跑在操作系统里面的)restfulapi典型的C/s架构由docker服务端的守护进程从dockerhub上下载了镜像(服务端会先检查本地系... 查看详情
docker学习|基础命令
...载(unionmount)容器通过镜像启动执行写时复制仓库公有dockerhub私有相关技术简介依赖的Linux内核特性Namespace命名空间LXCKernelNamespace封装->代码隔离->资源隔离PID进程隔离独立进程表NET管理网络接口networkinfoIPC进程通信额外信息... 查看详情
docker的部署与相关命令(代码片段)
Docker的部署与相关命令一、部署20版docker1、关闭防火墙及安全机制2、设置阿里云镜像源3、安装Docker-CE4、配置阿里云的镜像加速5、优化网络二、docker基础命令1、docker简单命令2、容器的操作3、私有仓库的操作4、Docker数据卷和数... 查看详情
docker常用命令(代码片段)
docker的使用命令1docker命令介绍docker--help管理命令:container管理容器image管理镜像network管理网络命令:attach介入到一个正在运行的容器build根据Dockerfile构建一个镜像commit根据容器的更改创建一个新的镜像cp在本地文件系统与容器... 查看详情
docker镜像管理基础(代码片段)
docker镜像管理基础文章目录docker镜像管理基础镜像的概念docker镜像层docker存储驱动AUFSOverlayFSDeviceMapperdockerregistrydocker镜像的制作DockerHubdocker镜像的获取镜像的生成基于容器制作镜像镜像的概念镜像可以理解为应用程序的集装箱... 查看详情