I need to get into interactive mode using docker compose, I have create a Dockerfile just for testing
Dockerfile
FROM ubuntu
CMD ["/bin/bash"]
and used this docker-compose
file which contains the two fields tty: true
and stdin_open: true
docker-compose
version: "3"
services:
app:
container_name: docker-test
build: .
image: docker-test
stdin_open: true
tty: true
but when I hit the command sudo docker-compose up
it doens't get into interactive mode, and it's the output
[+] Running 1/0
✔ Container docker-test Created 0.0s
Attaching to docker-test
I know that there is another solution to do that, by running the container in detached mode and then attach to this container by those commands sudo docker compose up -d
and then sudo docker attach <container_name>
.
But I wanna know, why the first way doesn't work.