Variable substitution in image tag
See original GitHub issueHi Kurt!
I’ve created a Scala.js sample application using your plugin: https://gitlab.com/bullbytes/scala-js-example
When running the app using docker-compose up, I’d like to use an environment variable to define which tag of the image to use (latest, staging, or production).
The default tag should be latest.
Thus, I added this to my docker-compose.yml, using Docker’s variable substitution with default values:
image: registry.gitlab.com/bullbytes/scala-js-example:${APP_DOCKER_IMAGE_TAG:-latest}
While this works using docker-compose up, I run into an error when executing dockerComposeUp in SBT:
Error parsing reference: "registry.gitlab.com/bullbytes/scala-js-example:${APP_DOCKER_IMAGE_TAG:-latest}" is not a valid repository/tag: invalid reference format
Here’s my docker-compose.yml.
Thanks!
P.S.: If you have any feedback for my example app (e.g., my build.sbt), I’d be more than glad to hear it. 😊
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Can I have an image with a substitution tag in a SendGrid ...
Go to the Import/Export section on the left Build sidebar (way down there), then click on Export HTML. Save the file and open...
Read more >Allow variable substitution in attributes · Issue #100 · pugjs/pug
I am trying to do something like this: img(src="#{imgurl}") but the #{...} placeholders are never replaced if used in attributes.
Read more >Creating substitution parameters for image paths in CKEditor ...
If your site uses CKEditor, you can create a substitution parameter to represent the variable part of an image path. When business users...
Read more >Environment variables in Compose | Docker Documentation
Substitute environment variables in Compose files . It's possible to use environment variables in your shell to populate values inside a Compose...
Read more >Permit variable substitution in gitlab-ci job image name.
I would like to use CI_COMMIT_TAG#v ( to substituate the v letter ) environment variable in image name.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@dpfeiffer & @mb720 - I made an update to the plugin that allows it to now handle docker-compose environment variables that are defined using the
${VARIABLE:-default}format introduced in version 2.1.If you do not define the environment variable value in the settings
variablesForSubstitutionorvariablesForSubstitutionTaskthen thedefaultvalue will be used.This change has been published in
1.0.22-SNAPSHOTLet me know if you find any issues with it before I merge it to master. Apologies for the delay.
@dpfeiffer - Thank you for verifying! The fix for this issue is now included in an official release:
addSbtPlugin("com.tapad" % "sbt-docker-compose" % "1.0.22")