Docker-compose is a wonderful tool, I use it all day. I fire up containers attach to them and do stuff. the short manual will show how to run a container and connect to it. I am not using Dockerfile in this example but that may be use as well if needed.
What we need is text editor to edit a simple fle called docker-compose.yaml this file will have all instructions ( minimal ones ) in order to run a basic cntainer orcastraded by docker-compose.
Here is the content of that docker-compose.yaml :
version: "3.7" services: mydeb: container_name: mydeb image: "debian" restart: "no" entrypoint: /bin/bash tty: true
To start the instance simply fire up the composer
docker-compose up -d
The dommand will create the container, network and required stuff, and start the container. if the image is not preset or if needed , you can also tell compose to pull it from repository.
How to connect to running docker-compose container , by running the exec command, against the refering service we created on our docker-compose.yaml
docker-compose exec mydeb bash