Accessing the image hash from within the container

Is is possible to access the hash-ID of the image used to create the container, from within the container? I want to provide a ‘signature version’ at the bottom of each page served from a php app running in a container.

I guess one way is to use Environment Variables from within the docker compose file:

  • Spark Docker - Can't access web UI for resource manager - Mac PC
  • Can docker containers within same host have same ports
  • automatically start /etc/init script in IBM Bluemix container
  • How can I preinstall software on travis-ci?
  • aws container service \ how dockers configured for communicating with each other
  • Is there any benefit to running docker containers on different Amazon servers?
  • environment:
          - IMAGE_HASH=${IMAGE_HASH}
    

    and then have a wrapper script first of all write the IMAGE_HASH=ABC123 to a .env file before running docker-compose up. The script can inspect the image to get the hash ID.

    But I wonder if there is a ‘proper’ way to do this? So from within the compose file something like:

    environment:
        - IMAGE_HASH=this.imagehash
    

  • kubectl: Connection to server was refused
  • using a maven docker plugin to commit and save an image on maven release
  • Why does MySQL Docker container complain that MYSQL_ROOT_PASSWORD env must be defined when using Docker 17.03 secrets?
  • What causes the EB cli to package an app as file name 1 (app-123456-654321.zip) vs file name 2 (9f1b.zip)?
  • add rethinkdb in docker-compose
  • run ionic framework into docker does not create localy folder/files
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.