NOISE知识效率集
🏷️

Docker 镜像

# 获取 Ubuntu 18.04 系统的基础镜像
docker pull ubuntu:18.04
# 创建容器并运行 bash 应用
docker run -it ubuntu:18.04 bash docker run -it ubuntu:18.04 /bin/bash
# 使用 tag 命令添加镜像标签
docker tag ubuntu:18.04 php74:latest
# 使用 inspect 命令查看详细信息
docker inspect php74:latest docker inspect -f {{".RepoTags"}} php74:latest
# 使用 history 命令查看镜像历史
docker history php74:latest --no-trunc
# 搜寻镜像
docker search --filter=is-official=true nginx
# 删除镜像
docker rmi php74:latest
# 自动清理临时的遗留镜像文件层
docker image prune -f
# 删除所有无用镜像,不光是临时镜像
docker image prune -a -f
# 基于已有容器创建
docker  commit 6f2e41b21d70
# 基于 Dockerfile 创建
FROM debian:stretch-slim LABEL version="1.0" maintainer="docker user <docker_user@github>" RUN apt-get update && \ apt-get install -y python3 && \ apt-get clean && \ rm -rf /var/lib/apt/lists/*
docker build -t python:3 .
# 存出镜像
docker save -o ubuntu_18.04.tar ubuntu:18.04
# 载入镜像
docker load -i ubuntu_18.04.tar
# 上传镜像
docker tag ubuntu:18.04 chishishuan/ubuntu:18.04 docker login ->chishishuan ->pwd docker push chishishuan/ubuntu:18.04
dockerhub
badge