question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Variable substitution in image tag

See original GitHub issue

Hi 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:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kurtkopchikcommented, Apr 24, 2017

@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 variablesForSubstitution or variablesForSubstitutionTask then the default value will be used.

This change has been published in 1.0.22-SNAPSHOT

resolvers += "Sonatype Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"
addSbtPlugin("com.tapad" % "sbt-docker-compose" % "1.0.22-SNAPSHOT")

Let me know if you find any issues with it before I merge it to master. Apologies for the delay.

0reactions
kurtkopchikcommented, Apr 27, 2017

@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")

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found