I have my docker-compose.yaml file like this:
version: "3"
services:
app:
build:
context: .
dockerfile: Dockerfile
ports:
- "8000:8000"
volumes:
- ./app:/app
command: >
sh -c "python manage.py runserver 0.0.0.0:8000"
sh -c "python simple_script.py"
and the problem is that when i run docker-compose up
it never reaches the second command ( sh -c "python simple_script.py"
) .
I think this is because the first command sh -c "python manage.py runserver 0.0.0.0:8000"
never exits.
Is there a way to run two commands like this?
2
Answers
You can write two commands in one line. like this –
can you try this one:
In linux you can use
&
to run commands in background.You can use
fg
to get back to it.