3 Docker
X edited this page 2024-08-28 15:58:41 +08:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

一、Docker带来了哪些改变

二、Docker安装与部署

  • 修改Docker数据目录
#编辑配置文件
vim /etc/docker/daemon.json
#添加配置
{
  "data-root": "/data/docker-home"
}
#重启服务
systemctl restart docker
#检查是否生效
docker info

三、Docker容器创建与启停

四、Docker镜像管理

#展示当前已经拉取到本地的镜像
docker images

#镜像拉取
docker pull  nginx

#搜索镜像仓库中的 nginx及其相关 镜像
docker search nginx

#删除nginx镜像
docker image rm nignx

#将ID为e1ca7233c2fa的镜像保存为本地/tmp目录下uptime-kuma.tar.gz
docker save e1ca7233c2fa -o /tmp/uptime-kuma.tar.gz

#将文件uptime-kuma.tar.gz已离线的方式导入为docker镜像并且命名为uptime-kuma:latest

[root@x tmp]# docker import /tmp/uptime-kuma.tar.gz uptime-kuma:latest
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
Getting image source signatures
Copying blob 2efd0f93ef9a done   | 
Copying config c48f9721a3 done   | 
Writing manifest to image destination
sha256:c48f9721a343d5b7e2e5eaf1d36c6f4235548db4207fa0d313161c3de8add5e9
[root@x tmp]# 
[root@x tmp]# docker images
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
REPOSITORY             TAG         IMAGE ID      CREATED         SIZE
localhost/uptime-kuma  latest      c48f9721a343  16 minutes ago  464 MB