How to know on host OS that a docker container is up

Hi,

I need to execute a script on host OS as soon as a specific container is up.
How would i know on the host OS?

Thanks.

There is no such thing as a post container started hook.

Though, you can listen to docker events to implement something yourself.
Here is a simple bash example on how to work with events: https://github.com/int128/docker-eventhandler/blob/master/eventhandler.sh

On the otherside, If you are experienced with developing applications, you could use the docker sdk of your choice and implement your own event hander for whatever purposes you like.

@meyay thanks for the eventhandler.sh example, it looks i can use it.
Ill get back if i face any issue with it.

Secondly, i am facing a problem with docker-compose environment config.

i need to set up a variable whose value contains a $
Actually its a password of somthing like: ‘abc$def’

environment:
PASS=abc$pqr

the docker config treats $pqr as some variable.

how to set the variable PASS with value ‘abc$pqr’

i tired with PASS=‘abc$pqr’ without success.

Thanks.

Regarding the script: it is not mine.

try $$ instead of . If I remember correctly, it should escape the character.

@meyay That was one of the quickest responses i have ever got!
Thanks, it worked.