stefanprodan / dockprom

Docker hosts and containers monitoring with Prometheus, Grafana, cAdvisor, NodeExporter and AlertManager
MIT License
5.97k stars 1.71k forks source link

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

Open Nelrann opened 1 year ago

Nelrann commented 1 year ago

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 commented 1 year ago

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

Nelrann commented 1 year ago

image image

nightah commented 1 year ago

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

Can you please try upgrade and retest?

rogersbarn commented 1 year ago

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 commented 1 year ago

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 commented 10 months ago

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 commented 7 months ago

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 commented 5 months ago

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.