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.
In order to list the Docker containers, we can use the “docker ps” or “docker container ls” command. This command provides a variety of ways to list and filter all containers on a particular Docker engine.
A Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings.
Like it was mentioned, if you are already inside of a container, then just use ps -eaf command to see the running processes.
The docker images, they are stored inside the docker directory: /var/lib/docker/ images are stored there.
There are (at least) three ways to interpret your question:
The way to get list of installed packages depends on distribution. There are three most popular families:
Use apk info -vv
command:
docker exec -i <container_id_1> apk info -vv | sort
Use dpkg -l
command:
docker exec -i <container_id_1> dpkg -l
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
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
OverlayFS
)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: 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: 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
You can get information concerning the image by using:
docker image inspect <image>
and docker image history <image>
and then if you want to get information concerning the container, simply enter in the running container using exec command docker container exec -itu 0 <container> /bin/bash
(pay attention your container may be using another shell) and afterward just gather the needed information (os, running processes, open files, etc)
More information about exec command: https://docs.docker.com/engine/reference/commandline/exec/.
PS: To list images docker image ls
, to list running containers docker container ps
Since Docker Desktop 4.7.0 you can use the experimental sbom
command to get the "Software Bill of Rights", which is a pretty comprehensive list of all contained libraries and corresponding versions. E.g.
$ docker sbom openjdk:11-jre-slim-buster
Syft v0.43.0
✔ Pulled image
✔ Loaded image
✔ Parsed image
✔ Cataloged packages [91 packages]
NAME VERSION TYPE
adduser 3.118 deb
apt 1.8.2.3 deb
base-files 10.3+deb10u12 deb
base-passwd 3.5.46 deb
bash 5.0-4 deb
bsdutils 1:2.33.1-0.1 deb
ca-certificates 20200601~deb10u2 deb
coreutils 8.30-3 deb
dash 0.5.10.2-5 deb
debconf 1.5.71+deb10u1 deb
debian-archive-keyring 2019.1+deb10u1 deb
[...]
As you can see it's based on Syft which is third party tool. That may change in the future though (hence experimental). In fact you can also use Syft directly so you don't need Docker Desktop.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With