I've created Dockerfile that is running gui, and after the container is executed I want it to run some bash script without freezing the container, so I am trying to run it as a background process but it seems like it's not executed at all.
Dockerfile:
FROM dorowu/ubuntu-desktop-lxde-vnc:latest
WORKDIR /data
COPY ./startup.sh /tmp/
COPY ./procedure.sh /tmp/
RUN chmod +x /tmp/startup.sh
RUN chmod +x /tmp/procedure.sh
CMD ["/tmp/startup.sh"]
startup.sh:
#!/bin/bash
cd /tmp && nohup ./procedure.sh > /dev/null 2>&1 &
procedure.sh:
#!/bin/bash
sleep 5
whoami > /tmp/log.txt
output=$(cat /tmp/log.txt)
My expectation is to have startup.sh
executed when the container is started, and then run procedure.sh
that will call to all of my flow.
As you can see I am printing the log into /tmp/log.txt
but actually nothing is getting created once the container is started.
If I am running the script /tmp/startup.sh
manually I can see the log.txt
is getting created properly.
I will appreciate your help!