Tagging images and containers #8
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Scope
Explore tagging images and containers in a versioned manner so that it is easier to detect what "version" of the container someone is running going forward in response to #7.
Implementation
Working with image tags makes working with
docker composeslightly more complicated. This PR addsenvironment/docker-environment-common.shto help abstract that complication away. Now, instead of lengthy and complicateddocker compose -f ...commands, you can use:environment/docker-environment-common.sh buildenvironment/docker-environment-common.sh upenvironment/docker-environment-common.sh startenvironment/docker-environment-common.sh stopenvironment/docker-environment-common.sh logsenvironment/docker-environment-common.sh down./environment/docker-environment-common.sh version./environment/docker-environment-common.sh tagsThe Docker image tag takes the form
datascience-notebook:${hash of the current commit in Git}. This is specified byimage: datascience-notebook:$TAGincompose.yml;$TAGis set by thebuildcommand inenvironment/docker-environment-common.shand saved inenvironment/image-tags.You can see your container's version with
./environment/docker-environment-common.sh version, provided Docker is running and the container is built and running.If the
org.opencontainers.image.versionvalue for your container matches that of a fellow researcher, you should be working from the same version of the Docker code.Things to note
The tag refers to the latest commit. That's mostly good. When it might go weird is if work is done on a branch over time (leading to commits) and someone needs to rebuild the containers or set up on a new machine, they'll have a different image tag even if the environment hasn't actually changed...
If that behavior does not work, lead researchers can elect to either
1. Hard code a value forThis probably won't work because $TAG won't be set in${TAG}inenvironment/compose.ymlenvironment/docker-environment-common.sh...2. Possibly (untested) – change the
retrieve_tag()function inenvironment/docker-environment-common.shto (replacingx.x.xwith the desired tag):This will more closely control the tag values across commits – the downside to this is that researchers will have to remember to manually change the tag value when the environment is changed.
TODO: add description of how implemented....
Future Work
None at this time
Testing
./environment/docker-environment-common.sh buildand./environment/docker-environment-common.sh upTo be completed by the person testing
Special considerations for making this live
environment/README.mdnow.