How do i send a signal FROM container TO host on some event?

I have a mariadb running in a container. On ‘docker run’, an import script (from a db dump) is run by mariadb, which creates users, builds schema, etc.

As the size of that dump script grows, the time to do the import increases. At this point it’s about 8-10 seconds, but i expect amount of data to increase substantially, and the import time will be more difficult to predict.

I’d like to be able to send a signal from the container to the host, to let it know that the data has been loaded, and that db is ready to be used. So far i have found info on how to send signal from one container to another container, but there’s no information on how to send signal from container to the host. Also, i need to be able to do this programmatically, as creating container is part part of a larger pipeline.

Ideally, i’d like to be able to do something like this:

client = docker.from_env()
db_c = client.containers.run('my_db_image', ....)

# check for signal from db_c container
# do other things

Thank you!

Source: StackOverflow