Try each way of connecting your terminal to a container and see what happens to the container afterwards.
Start a shell with no flags and check its status:
sh
docker run --name quick alpine:3.20 sh
docker ps -aNow with a terminal. Inside the container, save the Alpine release, then leave:
sh
docker run -it --name shell alpine:3.20 shtext
/ # cat /etc/alpine-release > /root/release.txt
/ # exitCheck what leaving did:
sh
docker inspect --format '{{.State.Status}}' shellSort ~/servers.txt inside a container named sorter by feeding it to stdin:
sh
cat ~/servers.txt
docker run -i --name sorter alpine:3.20 sort < ~/servers.txtLast, keep a shell running in the background and work in it through docker exec:
sh
docker run -dit --name toolbox alpine:3.20 sh
docker exec -it toolbox shtext
/ # touch /tmp/ready
/ # exitdocker ps should still list toolbox as Up.