# Signal trapping in containers with enabled initsystem

**URL:** <https://forums.balena.io/t/signal-trapping-in-containers-with-enabled-initsystem/4266>\
**Category:** Product support\
**Created:** [October 30, 2018, 4:57pm UTC](https://forums.balena.io/t/signal-trapping-in-containers-with-enabled-initsystem/4266 "2018-10-30T16:57:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tschebbischeff](https://avatars.discourse-cdn.com/v4/letter/t/54ee81/32.png) [@Tschebbischeff](https://forums.balena.io/u/Tschebbischeff)\
**Post date:** [October 30, 2018, 4:57pm UTC](https://forums.balena.io/t/signal-trapping-in-containers-with-enabled-initsystem/4266/1 "2018-10-30T16:57:03Z")

</div>

Good day,

I’m having a problem with a fairly simple setup, our containers do not receive any kind of SIGTERM signal in their scripts. I have tried it with the following simple script:

> #!/bin/bash  
> terminate() {  
> trap - 15  
> echo “SIGTERM”  
> }  
> trap terminate 15  
> echo “Idling now…”  
> while :; do sleep 1; done

I’m setting

> ENV INITSYSTEM on

in the dockerfile as well as

> CMD /sonah/src/test.sh

to start the script.

When hitting stop in the resin dashboard the container does NOT print SIGTERM.

---

<div class="post-metadata">

**Author:** ![majorz](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/majorz/32/639_2.png) [@majorz](https://forums.balena.io/u/majorz)\
**Post date:** [October 30, 2018, 9:12pm UTC](https://forums.balena.io/t/signal-trapping-in-containers-with-enabled-initsystem/4266/4 "2018-10-30T21:12:56Z")

</div>

Hi, this is a known issue. I will ping our base images maintainer for more information on this.

---

<div class="post-metadata">

**Author:** ![majorz](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/majorz/32/639_2.png) [@majorz](https://forums.balena.io/u/majorz)\
**Post date:** [October 30, 2018, 9:27pm UTC](https://forums.balena.io/t/signal-trapping-in-containers-with-enabled-initsystem/4266/8 "2018-10-30T21:27:58Z")

</div>

Do you also happen to overwrite the ENTRYPOINT in your Dockerfile?

---

<div class="post-metadata">

**Author:** ![Tschebbischeff](https://avatars.discourse-cdn.com/v4/letter/t/54ee81/32.png) [@Tschebbischeff](https://forums.balena.io/u/Tschebbischeff)\
**Post date:** [October 31, 2018, 11:58am UTC](https://forums.balena.io/t/signal-trapping-in-containers-with-enabled-initsystem/4266/10 "2018-10-31T11:58:36Z")

</div>

No, we don’t use an ENTRYPOINT.  
Currently this is how our own base images look:

```
FROM resin/raspberrypi3-python:3.6
ENV INITSYSTEM on

####################
### Initialize ###
####################
RUN ["cross-build-start"]

# Redacted section, but includes ONLY commands like:
# RUN mkdir <directory>
# COPY <pathonlocal> <pathondevice>
# RUN chmod +x <pathondevice>/<filename>.sh && <pathondevice>/<filename>.sh
# RUN rm -rf <pathondevice>

RUN ["cross-build-end"]

```

We then use this base image in our image like so:

```
FROM <redacted>
ENV INITSYSTEM on

# Redacted section, but includes ONLY commands like:
# RUN mkdir <directory>
# RUN mkdir <directory> <directory2> ...
# COPY <pathonlocal> <pathondevice>
# RUN chmod +x <pathondevice>/<filename>.sh && <pathondevice>/<filename>.sh
# RUN rm <pathondevice>

RUN chmod +x /sonah/src/test.sh
CMD /sonah/src/test.sh

```

Greetings, Tarek

---

<div class="post-metadata">

**Author:** ![majorz](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/majorz/32/639_2.png) [@majorz](https://forums.balena.io/u/majorz)\
**Post date:** [October 31, 2018, 12:38pm UTC](https://forums.balena.io/t/signal-trapping-in-containers-with-enabled-initsystem/4266/11 "2018-10-31T12:38:08Z")

</div>

Hi Tarek,

I got an update from our base images maintainer that we are working on releasing a new set of base images, which should be ready in a few days. We will send you an update on this once ready.

Thanks a lot,  
Zahari

---

<div class="post-metadata">

**Author:** ![agherzan](https://avatars.discourse-cdn.com/v4/letter/a/e95f7d/32.png) [@agherzan](https://forums.balena.io/u/agherzan)\
**Post date:** [November 7, 2018, 7:13pm UTC](https://forums.balena.io/t/signal-trapping-in-containers-with-enabled-initsystem/4266/34 "2018-11-07T19:13:26Z")

</div>

Hi. We have an update on the new images. They are currently available at [https://store.docker.com/community/images/balenalib/raspberrypi3-debian-python/tags](https://store.docker.com/community/images/balenalib/raspberrypi3-debian-python/tags) . Please be aware of the following breaking changes:

- udev defaults to off
- INITSYSTEM has been completely removed, so applications that rely on systemd should install and set up systemd in their apps
- removed automatic mounting of devtmpfs
- dropped support for Debian Wheezy

Given the list of the changes I pointed to above, we strongly recommend testing the app in an isolated lab environemnt before rolling it to production devices.
