So I followed the guide to add an entryscript into the Dockerfile
ADD shell.sh /home/shell.sh
RUN chmod +x /home/shell.sh
EXPOSE 80/tcp 443/tcp
ENTRYPOINT ["/home/shell.sh"]
And because I don’t want the container to exit instantly, I added a /bin/bash to hold the container.
[…]
/bin/bash
Now here’s something which I don’t understand happens:
After the container runs, it will go into the bash.
You can type exit once, and exit once to another layer of bash, will be able to reattach, but if you type exit again, the other layer of bash exits and container stops.
However, if I remove the /bin/bash and run container, it exits instantly after the entrypoint is done.
So it’s either bash inside bash or 1 bash but exits instantly(the interface will show, but instantly exits).
My starting arguments:
docker run
–detach
–tty
–interactive
–network staticnetwork
–ip 172.11.0.230
–name $CONTAINER_NAME
$IMAGE_NAME
( equivalent to -dit some post suggests )