0

My scenario is that I have a bunch of next.js apps. I start all of them in production mode (yarn start) by docker compose up. The docker-compose file looks like below

version: '3'
services:
  website:
    ...
  admin:
    ...
  website-api:
    ...
  admin-api:
    ...

When I'm coding a service, I'd like to re-run the container of that service in an interactive shell, so I could run whatever commands I needed (eg. yarn dev or running test). And keep other services in production

Is there any way I can archive that?

I read about using another docker-compose.overwrite.yml for development. But in my case, I only need one service run in development and keep others in production. So this solution is not fit for me.

Need help!

Tu Le Thanh
  • 542
  • 1
  • 6
  • 18
  • You could [`docker-compose run`](https://docs.docker.com/engine/reference/commandline/compose_run/) a container with an alternate command but taking most of the settings from your `docker-compose.yml`. I also find it works well to do day-to-day development in a principally host-based environment even if I'm eventually deploying via Docker. – David Maze Jan 09 '23 at 12:04

0 Answers0