title: Why a dockerized script have a different behaviour when I docker run or I docker execute it?
body: <p>I'm using a python script for send websocket notification,
  as suggested <a href="https://websocket-client.readthedocs.io/en/latest/getting_started.html" rel="nofollow noreferrer">here</a>.</p>
  <p>The script is <code>_wsdump.py</code> and I have a script <code>script.sh</code> that is:</p>
  <pre><code>#!/bin/sh
  
  set -o allexport
  . /root/.env set
  
  env
  
  python3 /utils/_wsdump.py &quot;wss://mywebsocketserver:3000/message&quot; -t &quot;message&quot; &amp;
  </code></pre>
  <p>If I try to dockerizing this script with this <code>Dockerfile</code>:</p>
  <pre><code>FROM python:3.8-slim-buster
  
  RUN set -xe \
      pip install --upgrade pip wheel &amp;&amp; \
      pip3 install websocket-client
  
  ENV TZ=&quot;Europe/Rome&quot;
  
  ADD utils/_wsdump.py /utils/_wsdump.py
  ADD .env /root/.env
  ADD script.sh /
  
  ENTRYPOINT [&quot;./script.sh&quot;]
  CMD []
  </code></pre>
  <p>I have a strange behaviour:</p>
  <ul>
  <li><p>if I execute <code>docker run -it --entrypoint=/bin/bash mycontainer</code> and after that I call the <code>script.sh</code> everything works fine and I receive the notification.</p>
  </li>
  <li><p>if I run <code>mycontainer</code> with <code>docker run mycontainer</code> I see no errors but the notification doesn't arrive.</p>
  </li>
  </ul>
  <p>What could be the cause?</p>