[ドッカー] $ 2_画像管理

ドッキングウィンドウの画像管理

1.レビューミラーのリスト

# Management Commands $ docker image ls

///查看 ubuntu 仓库的镜像:

$ docker image ls ubuntu

2.表示された画像情報

# Management Commands $ docker image inspect ubuntu

3.検索ミラー

$ docker search ubuntu

4.ミラープル

# Management Commands $ docker image pull [OPTIONS] NAME[:TAG|@DIGEST]

$ docker image pull ubuntu:14.04

ミラーの5.建設

# Management Commands $ docker container commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]

# 使用 run 创建运行一个新命令
$ docker container run \
    --name shiyanlou001 \
    -it busybox /bin/sh

# 在运行的容器中创建两个文件,test1 和 test2
touch test1 test2

# 使用 ctrl + p  及  ctrl+q 键退出

# 使用提交命令,提交容器 shiyanlou001 的修改到镜像 busybox:test 中
$ docker container commit shiyanlou001 busybox:test

# 查看通过提交创建的镜像
$ docker image ls busybox

docker image build [OPTIONS] PATH | URL

# 指定基础镜像
FROM ubuntu:14.04

# 维护者信息
MAINTAINER shiyanlou/[email protected]

# 镜像操作命令
RUN \
    apt-get -yqq update && \
    apt-get install -yqq apache2

# 容器启动命令
CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]

///创建一个空目录,并在其中编辑 Dockerfile 文件,并基于此构建一个新的镜像

# 首先创建目录并切换目录
$ mkdir /home/shiyanlou/test1 && cd /home/shiyanlou/test1

# 编辑 Dockerfile 文件,默认文件名为 `Dockerfile`,也可以使用其它值,使用其它值需要在构建时通过 `-f` 参数指定,这里我们使用默认值。并在其中添加上述示例的内容
$ vim Dockerfile

# 使用 build 命令,`-t` 参数指定新的镜像
$ docker image build -t shiyanlou:1.0 .
///使用该镜像启动一个容器来运行 apache 服务

# 使用 -p 参数将本机的 8000 端口映射到容器中的 80 端口上。
$ docker container run \
    -d -p 8000:80 \
    --restart=always \
    --name shiyanlou002 shiyanlou:1.0

6.削除ミラー

管理コマンド

$ docker image rm ubuntu:latest

公開された78元の記事 ウォンの賞賛0 ビュー1434

おすすめ

転載: blog.csdn.net/qq_30782921/article/details/101633746