Skip to content

reduardo7/docker-on-ready

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker On Run / On Ready / On Start

Imagine: After the mongodb start, it will dump db2dump and restore it.

Then, how to implement an "On Run" / "On Ready" event on Docker?

How to

You can use the HEALTHCHECK to do something like these examples:

Documentation

Issues & References

Example output

  • You can see the error cat: /test.txt: No such file or directory until the health check is ready.
  • You can see only one x inside /test.txt after run, because the init script was executed only once.
Creating network "tmp_default" with the default driver
Creating tmp_test_1 ... done
Attaching to tmp_test_1
test_1  | + set +e
test_1  | + true
test_1  | + cat /test.txt
test_1  | cat: /test.txt: No such file or directory
test_1  | + sleep 3
test_1  | + true
test_1  | + cat /test.txt
test_1  | cat: /test.txt: No such file or directory
test_1  | + sleep 3
test_1  | + true
test_1  | + cat /test.txt
test_1  | x
test_1  | + sleep 3
test_1  | + true
test_1  | + cat /test.txt
test_1  | x
test_1  | + sleep 3
test_1  | + true
test_1  | + cat /test.txt
test_1  | x
test_1  | + sleep 3

About

Docker On Run / On Ready

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published