Skip to content

Conversation

@xiagw
Copy link

@xiagw xiagw commented May 20, 2023

No description provided.

@deitch
Copy link
Collaborator

deitch commented May 21, 2023

I don't mind. What does it gain us?

@xiagw
Copy link
Author

xiagw commented May 22, 2023

Securely exit the program and save time.

@deitch
Copy link
Collaborator

deitch commented May 22, 2023

I guess. Make entrypoint part of the ENTRYPOINT, please. It could be possible to add other arguments that should be passed to it

Copy link

@galti3r galti3r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Work for me.

Without PR

❯ docker compose exec mysql-backup bash
87ebbd66780c:/$ ps
PID   USER     TIME  COMMAND
    1 appuser   0:00 {entrypoint} /bin/bash /entrypoint
    9 appuser   0:00 sleep 60
   10 appuser   0:00 bash
   16 appuser   0:00 ps
87ebbd66780c:/$ 
exit

~/Repositories/Kadiska/mysql-backup on master
❯ docker compose restart
[+] Restarting 3/3
 ✔ Container mysql-backup-mysql-1         Started                                              2.1s 
 ✔ Container mysql-backup-wordpress-1     Started                                              1.5s 
 ✔ Container mysql-backup-mysql-backup-1  Started                                             10.4s 

Container mysql-backup-mysql-backup-1 Started 10.4s

With PR

❯ docker compose exec mysql-backup bash
a2cd172bfea6:/$ ps
PID   USER     TIME  COMMAND
    1 appuser   0:00 /usr/bin/dumb-init -- /entrypoint
    7 appuser   0:00 {entrypoint} /bin/bash /entrypoint
   22 appuser   0:00 sleep 86400
   29 appuser   0:00 bash
   35 appuser   0:00 ps
a2cd172bfea6:/$
exit

~/mysql-backup on master !1 ?1
❯ docker compose restart
[+] Restarting 3/3
 ✔ Container mysql-backup-mysql-backup-1  Started        0.4s
 ✔ Container mysql-backup-wordpress-1     Started        1.6s
 ✔ Container mysql-backup-mysql-1         Started        1.8s

Container mysql-backup-mysql-backup-1 Started 0.4s

@deitch
Copy link
Collaborator

deitch commented Aug 10, 2023

Looks fine to me. Awaiting a rebase and fixing the ENTRYPOINT/CMD

@galti3r
Copy link

galti3r commented Aug 10, 2023

Looks fine to me. Awaiting a rebase and fixing the ENTRYPOINT/CMD

About dumb-init
There is multiple approach :

  • (Good solution) Manage SIGNAL traps directly inside bash program
  • (Good workaround solution with more features inthebox) Use dumb-init as ENTRYPOINY then load CMD command. Actual entrypoint file can be renamed run.sh for easiest understanding. Also self traps management could be a good solution to advertise any restart during dump or restore. Actually after 10s (by default), program will be killed, even if restore is processing.
  • (Crapy solution) change docker-compose container timeout, with stop_grace_period: 1s for example

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

Successfully merging this pull request may close these issues.

3 participants