如何列出Docker容器中包含的所有应用程序? [英] How do I list all applications that are contained in a docker container?

查看:1269
本文介绍了如何列出Docker容器中包含的所有应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经下载了一个Docker容器,该容器使用几种不同的软件对输入文件执行几种不同的操作,即对齐,变体调用等。如何确定Docker容器/映像的内容是什么?抱歉,如果这很琐碎,我是docker的新手。

解决方案

(至少)有三种方式可以谈论您的问题:



  • 您可能会问容器中安装了哪些软件包

  • 您可能会问有什么文件

  • 您可能很好奇



    tomastomecek / sen



    $ dockviz容器-d -r | dot -Tpng -o container.png


    容器带有标记的链接线可视化。

      $ dockviz container -d -r |点-Tpng -o container.png 



    I have downloaded a docker container that performs several different operations on an input file using several different kinds of software, i.e. alignment, variant calling etc. How do I find out what the contents of the docker container/image is? Sorry if this is trivial I am totally new to docker.

    解决方案

    There are (at least) three ways to speak about your question:

    • You may ask which packages installed in the container;
    • You may ask what files there are;
    • You may be curious what images and layers does the container consist of?

    1. List packages installed in container

    The way to get list of installed packages depends on distribution. Here three most popular families:

    • Alpine, lightweight Linux distribution based on musl and BusyBox
    • Debian-based (Debian, Ubuntu)
    • rpm-based (RHEL, CentOS and Fedora)

    Alpine-based containers

    Use apk info -vv command:

    docker exec -i <container_id_1>  apk info -vv | sort
    

    Debian & Ubuntu - based containers

    Use dpkg -l command:

    docker exec -i <container_id_1>  dpkg -l
    

    RHEL, CentOS and Fedora - based containers

    Use rpm -qa or yum list installed command:

    docker exec -i <container_id_1>  rpm -qa
    docker exec -i <container_id_1>  yum list installed
    

    2. Explore container's filesystem

    To see directory structure you can use either bash & tree or cool tools developed specially for exploring docker images

    tree

    docker exec -i <container_id_1> tree /
    

    Note: not all images contain tree command.

    docker export with tar

    docker export adoring_kowalevski > contents.tar And then, tou can explore contents.tar with your preferred archiver. I.e. for tar:

    tar -tvf contents.tar

    3. Special tools (explore images and layers OverlayFS)

    wagoodman/dive

    wagoodman/dive: A tool for exploring each layer in a docker image

    docker run --rm -it \ 
      -v /var/run/docker.sock:/var/run/docker.sock \
      wagoodman/dive:latest \
      <image_name|image_id>
    

    A tool for exploring a docker image, layer contents, and discovering ways to shrink your Docker image size.

    tomastomecek/sen

    TomasTomecek/sen: Terminal User Interface for docker engine

    docker run -v /var/run/docker.sock:/run/docker.sock -ti -e TERM tomastomecek/sen

    it can interactively manage your containers and images:

    justone/dockviz

    justone/dockviz: Visualizing Docker data

    $ dockviz containers -d -r | dot -Tpng -o containers.png

    Containers are visualized with labelled lines for links. Containers that aren't running are greyed out.

    $ dockviz containers -d -r | dot -Tpng -o containers.png
    

    这篇关于如何列出Docker容器中包含的所有应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆