Print (default) cmd and entrypoint
The following cammand includes printf
in the format to separate the value for cmd and *entrypoint*` with a new line:
docker inspect -f '{{printf "%s\n%s" .Config.Cmd .Config.Entrypoint}}' env-test
Print environment variables
$ docker inspect --format '{{json .Config.Env}}' container-registry.oracle.com/database/free | jq
[
"ORACLE_BASE=/opt/oracle",
"ORACLE_HOME=/opt/oracle/product/23c/dbhomeFree",
"INSTALL_FILE_1=http://localhost:8080/23.2.0/oracle-database-free-23c-1.0-1.el8.x86_64.rpm",
"RUN_FILE=runOracle.sh",
"PWD_FILE=setPassword.sh",
"CREATE_DB_FILE=createDB.sh",
"USER_SCRIPTS_FILE=runUserScripts.sh",
"CONF_FILE=oracle-free-23c.conf",
"CHECK_SPACE_FILE=checkSpace.sh",
"CHECK_DB_FILE=checkDBStatus.sh",
"SETUP_LINUX_FILE=setupLinuxEnv.sh",
"CONFIG_TCPS_FILE=configTcps.sh",
"INSTALL_DIR=/install",
"ORACLE_DOCKER_INSTALL=true",
"CHECKPOINT_FILE_EXTN=.created",
"PREINSTALL_FILE=http://localhost:8080/23.2.0/oracle-database-preinstall-23c-1.0-0.5.el8.x86_64.rpm",
"PATH=/opt/oracle/product/23c/dbhomeFree/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"ENABLE_ARCHIVELOG=false",
"ORACLE_SID=FREE",
"ORACLE_PDB=FREEPDB1",
"ORACLE_PWD=",
"AUTO_MEM_CALCULATION=false"
]
Get a container's IP address
$ docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $CONTAINER
$ docker inspect $CONTAINER | jq -r ".[0].NetworkSettings.Networks.\"$NETWORKNAME\".IPAddress"
Print the mounted volumes for a container
$ docker inspect -f '{{ .Mounts }}' $CONTAINER
[{bind /home/rene/local/directory /home/rene/directory/in/container true rprivate}]
Compare with docker volume
See also /var/lib/docker/volumes