Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invalid interpolation format for services.caddy.environment.[]: "$2a$14$1l.IozJ...". You may need to escape any $ with another $. #276

Open
Nelrann opened this issue Nov 18, 2022 · 8 comments

Comments

@Nelrann
Copy link

Nelrann commented Nov 18, 2022

Error when a try to clone and start project

invalid interpolation format for services.caddy.environment.[]: "$2a$14$1l.IozJx7xQRVmlkEQ32OeEEfP5mRxTpbDTCTcXRqn19gXD8YK1pO". You may need to escape any $ with another $.

@nightah
Copy link
Collaborator

nightah commented Nov 19, 2022

What version of Docker compose are you having this issue with, I suspect <v2.x?

@Nelrann
Copy link
Author

Nelrann commented Nov 19, 2022

image
image

@nightah
Copy link
Collaborator

nightah commented Dec 14, 2022

I cannot replicate this with Docker 20.10.21 and Docker compose 2.14.0.

Can you please try upgrade and retest?

@rogersbarn
Copy link

I've ran in this issue before.
`You may need to escape any $ with another $'
In your case that would be
from
"$2a$14$1l.IozJx7xQRVmlkEQ32OeEEfP5mRxTpbDTCTcXRqn19gXD8YK1pO".
to
"$$2a$$14$$1l.IozJx7xQRVmlkEQ32OeEEfP5mRxTpbDTCTcXRqn19gXD8YK1pO".

After that docker compose worked for me

@makwanji
Copy link

I am still getting this error :(.

ubuntu@ip-172-31-33-157:~/dockprom$ ADMIN_USER='admin' ADMIN_PASSWORD='admin' ADMIN_PASSWORD_HASH="$$2a$$14$$1l.IozJx7xQRVmlkEQ32OeEEfP5mRxTpbDTCTcXRqn19gXD8YK1pO" docker compose up -d
invalid interpolation format for services.caddy.environment.[]: "$2a$14$1l.IozJx7xQRVmlkEQ32OeEEfP5mRxTpbDTCTcXRqn19gXD8YK1pO". You may need to escape any $ with another $

@billyliuschill
Copy link

In your docker-compose.yaml, manually hand edit the environmental variable like so:

    environment:
      - ADMIN_USER=${ADMIN_USER:-admin}
      - ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin}
      - ADMIN_PASSWORD_HASH=${ADMIN_PASSWORD_HASH:-$$2a$$14$$1l.IozJx7xQRVmlkEQ32OeEEfP5mRxTpbDTCTcXRqn19gXD8YK1pO}

@pmharris77
Copy link

pmharris77 commented Jan 28, 2024

Having same issue with Docker compose V2.23.0, but shouldn't a PR be raised to add the escaping of the $ in the hash, or does it only affect those using V2.x of compose?

@nightah
Copy link
Collaborator

nightah commented Mar 19, 2024

I am still getting this error :(.

ubuntu@ip-172-31-33-157:~/dockprom$ ADMIN_USER='admin' ADMIN_PASSWORD='admin' ADMIN_PASSWORD_HASH="$$2a$$14$$1l.IozJx7xQRVmlkEQ32OeEEfP5mRxTpbDTCTcXRqn19gXD8YK1pO" docker compose up -d
invalid interpolation format for services.caddy.environment.[]: "$2a$14$1l.IozJx7xQRVmlkEQ32OeEEfP5mRxTpbDTCTcXRqn19gXD8YK1pO". You may need to escape any $ with another $

I'm not really sure why this doesn't work because it looks like you're escaping with double quotes properly, it might have something to do with your shell and its interpolation. You could try using single quotes instead and removing the escaping of $ with another $ like below.

ADMIN_USER='admin' ADMIN_PASSWORD='admin' ADMIN_PASSWORD_HASH="$$2a$$14$$1l.IozJx7xQRVmlkEQ32OeEEfP5mRxTpbDTCTcXRqn19gXD8YK1pO" docker compose up -d

Can become:

ADMIN_USER='admin' ADMIN_PASSWORD='admin' ADMIN_PASSWORD_HASH='$2a$14$1l.IozJx7xQRVmlkEQ32OeEEfP5mRxTpbDTCTcXRqn19gXD8YK1pO' docker compose up -d

You only need to escape $ with another $ if utilising double quotes ".

The default in the docker-compose works without any issues, you can test this by cloning a fresh repository and attempting a docker-compose up -d.

Either replace the defaults in the compose file with your actual hashes or utilise the appropriate quoting/escaping when prepending the docker compose up -d command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants