How to Handle Shell Prompts in Docker Logs?

0
0
Asked By CodingNinja92 On

I'm working with a Docker container that needs me to respond to some prompts during development. The catch is that these prompts are outputting directly to the logs, and even with the `-it` flag when I run the container, I can't get access to the actual prompt. Has anyone dealt with this situation, and if so, how can I handle the prompts properly?

2 Answers

Answered By CuriousCoder42 On

How are you starting your dev environment? That could be a key part of the issue!

DevDude33 -

I'm using Docker Compose to set everything up. My service configuration looks something like this:

payload:
build: .
ports:
- '3000:3000'
volumes:
- images:/app/media
depends_on:
- postgres
env_file:
- .env

In my `docker-compose.dev.yml`, I have:

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`.

Answered By TechWhiz88 On

Why do you need to answer prompts at all? Have you thought about just putting these configurations directly into a config file? It might save you time in the long run.

CodingNinja92 -

I won't actually be answering any prompts myself. It's for a database migration, and my framework prompts for confirmation to apply those migrations, so I do need to interact with it.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.