Sample Output
1 | # docker ps |
Cheat Sheet
List the currently running Docker containers on the system
1
docker ps
Retrieves detailed information about a specific Docker container
1
2
3
4
5# Syntax
docker inspect <container_id>
# Eg.
sudo docker inspect f804735bd4ecReturn in json format
Retrieves specific information about the labels set on a Docker container
1
2
3
4
5# Syntax
docker inspect --format '{{json .Config.Labels}}' <container_id>
# Eg.
sudo docker inspect --format '{{json .Config.Labels}}' f804735bd4ec--format '{{json .Config.Labels}}'
: This specifies a custom output format using Go templates. In this case:{{json .Config.Labels}}
formats the output as JSON, extracting theLabels
field from the container’s configuration. This field contains metadata about the container.
Output
1
{"build_version":"Linuxserver.io version:- 0.6.21-ls273 Build-date:- 2024-06-30T01:47:03+00:00","maintainer":"notdriz","org.opencontainers.image.authors":"linuxserver.io","org.opencontainers.image.created":"2024-06-30T01:47:03+00:00","org.opencontainers.image.description":"[Calibre-web](https://github.com/janeczku/calibre-web) is a web app providing a clean interface for browsing, reading and downloading eBooks using an existing Calibre database. It is also possible to integrate google drive and edit metadata and your calibre library through the app itself. This software is a fork of library and licensed under the GPL v3 License. ","org.opencontainers.image.documentation":"https://docs.linuxserver.io/images/docker-calibre-web","org.opencontainers.image.licenses":"GPL-3.0-only","org.opencontainers.image.ref.name":"a2858e4b08582f09f22ea8f5280a9820feeaa78b","org.opencontainers.image.revision":"a2858e4b08582f09f22ea8f5280a9820feeaa78b","org.opencontainers.image.source":"https://github.com/linuxserver/docker-calibre-web","org.opencontainers.image.title":"Calibre-web","org.opencontainers.image.url":"https://github.com/linuxserver/docker-calibre-web/packages","org.opencontainers.image.vendor":"linuxserver.io","org.opencontainers.image.version":"0.6.21-ls273"}
Start an interactive shell session inside a running Docker container
1
2
3
4
5# Syntax
docker exec -it <container_name> <shell choice>
# Eg.
sudo docker exec -it linuxserver-calibre-web /bin/bashdocker exec
: Run a command in a running container.-it
: A combination of two flags:-i
: Stands for “interactive,” allowing you to interact with the container.-t
: Stands for “pseudo-TTY,” which allocates a terminal for the session, enabling you to use commands interactively.
Output
1
root@linuxserver-calibre-web:/
Lists all the Docker images available on your local system
1
sudo docker images
1
2REPOSITORY TAG IMAGE ID CREATED SIZE
linuxserver/calibre-web latest 544844635d79 5 days ago 778MBDisplays the history of a specific Docker image, showing the layers and changes that make up the image
1
2
3
4
5# Syntax
docker history <image_name>
# Eg.
sudo docker history linuxserver/calibre-web:latest1
2
3
4
5IMAGE CREATED CREATED BY SIZE COMMENT
544844635d79 5 days ago VOLUME [/config] 0B buildkit.dockerfile.v0
<missing> 5 days ago EXPOSE map[8083/tcp:{}] 0B buildkit.dockerfile.v0
<missing> 5 days ago COPY /usr/bin/unrar-ubuntu /usr/bin/unrar # … 1.74MB buildkit.dockerfile.v0
......
Reference
About this Post
This post is written by Andy, licensed under CC BY-NC 4.0.