How to Handle Shell Prompts Outputting to Logs in Docker?

0
1
Asked By CuriousCat92 On

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?

2 Answers

Answered By TechWhiz88 On

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

Answered By QuestionMarkLover On

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.

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.