{"action":"created","issue":{"url":"https://api.github.com/repos/docker/docker/issues/15402","labels_url":"https://api.github.com/repos/docker/docker/issues/15402/labels{/name}","comments_url":"https://api.github.com/repos/docker/docker/issues/15402/comments","events_url":"https://api.github.com/repos/docker/docker/issues/15402/events","html_url":"https://github.com/docker/docker/issues/15402","id":99642322,"number":15402,"title":"SIGTERM not sent to process?","user":{"login":"k2xl","id":965260,"avatar_url":"https://avatars.githubusercontent.com/u/965260?v=3","gravatar_id":"","url":"https://api.github.com/users/k2xl","html_url":"https://github.com/k2xl","followers_url":"https://api.github.com/users/k2xl/followers","following_url":"https://api.github.com/users/k2xl/following{/other_user}","gists_url":"https://api.github.com/users/k2xl/gists{/gist_id}","starred_url":"https://api.github.com/users/k2xl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/k2xl/subscriptions","organizations_url":"https://api.github.com/users/k2xl/orgs","repos_url":"https://api.github.com/users/k2xl/repos","events_url":"https://api.github.com/users/k2xl/events{/privacy}","received_events_url":"https://api.github.com/users/k2xl/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-08-07T12:55:32Z","updated_at":"2015-08-07T13:18:23Z","closed_at":"2015-08-07T13:18:23Z","body":"```\r\n#!/bin/bash\r\n_term() { \r\n  echo \"Caught SIGTERM signal!\" \r\n}\r\ntrap _term SIGTERM\r\necho \"hi\"\r\nsleep 100000\r\nwait $!\r\n```\r\nThis bash script is what is called via the CMD in my Dockerfile\r\n\r\nWhen running docker stop, I don't see Caught SIGTERM signal!\r\n\r\nI'm running docker version 1.7.0"},"comment":{"url":"https://api.github.com/repos/docker/docker/issues/comments/128696772","html_url":"https://github.com/docker/docker/issues/15402#issuecomment-128696772","issue_url":"https://api.github.com/repos/docker/docker/issues/15402","id":128696772,"user":{"login":"cpuguy83","id":799078,"avatar_url":"https://avatars.githubusercontent.com/u/799078?v=3","gravatar_id":"","url":"https://api.github.com/users/cpuguy83","html_url":"https://github.com/cpuguy83","followers_url":"https://api.github.com/users/cpuguy83/followers","following_url":"https://api.github.com/users/cpuguy83/following{/other_user}","gists_url":"https://api.github.com/users/cpuguy83/gists{/gist_id}","starred_url":"https://api.github.com/users/cpuguy83/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cpuguy83/subscriptions","organizations_url":"https://api.github.com/users/cpuguy83/orgs","repos_url":"https://api.github.com/users/cpuguy83/repos","events_url":"https://api.github.com/users/cpuguy83/events{/privacy}","received_events_url":"https://api.github.com/users/cpuguy83/received_events","type":"User","site_admin":false},"created_at":"2015-08-07T13:18:23Z","updated_at":"2015-08-07T13:18:23Z","body":"This is because of sleep. The process doesn't receive the signal until after your sleep is received (nothing to do with docker).\r\nNotice if you ctrl+c (which is SIGINT) out of the sleep it will show your message from the TERM handler.\r\nif you do:\r\n\r\n```bash\r\nwhile true; do\r\n    sleep 1\r\ndone\r\n```\r\n And then send sigterm, you'll get your signal handler.\r\n\r\nClosing as this is a non-issue."}}