Docker compose



cd examples/interactive-shell
$ docker-compose up

In another terminal, but in the same directory you can run one-of commands on the running container:


$ docker exec interactive-shell_one_1 hostname

You can also attach to it:


$ docker attach interactive-shell_one_1

However, when you exit, it will shut down the container.


examples/interactive-shell/docker-compose.yml
version: '3.7'
services:
 one:
   image: ubuntu:20.04
   stdin_open: true
   tty: true