How to Handle Shell Prompts Outputting to Logs in Docker?

June 12, 2025 2 answers
Asked by CuriousCat92
I'm working with a Docker container that requires me to respond to some prompts during development, but the prompts are showing up in the logs instead of the console. I've tried running the container with the `-it` option, but I still can't access the prompts. Does anyone know how to address this issue?

Answers

QuestionMarkLover
Why do you need to answer these prompts at all? Wouldn't it be easier to just include the necessary settings in a configuration file?

CuriousCat92: In this case, I can't provide the prompt answers upfront because I'm dealing with some database migrations that have to be confirmed at runtime. The framework prompts for those actions, so I need to interact with it.

Reply to this answer
TechWhiz88
How are you starting your development environment? Could you share your Docker Compose setup? It might help figure out what's going wrong.

CuriousCat92: Sure! Here's the Docker Compose configuration I'm using: ```yaml payload: build: . ports: - '3000:3000' volumes: - images:/app/media depends_on: - postgres env_file: - .env ``` And this is in my `docker-compose.dev.yml`: ```yaml services: payload: build: target: development develop: watch: - action: sync path: . target: /app ignore: node_modules stdin_open: true tty: true ``` I run it with `docker compose -f docker-compose.yml -f docker-compose.dev.yml up`.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions