I have a docker-compose.yml file that contains 4 containers: redis, postgres, api, worker
During the development of worker, I often need to restart it i
Since some of the other answers include info on rebuilding, and my use case also required a rebuild, I had a better solution (compared to those).
There's still a way to easily target just the one single worker container that both rebuilds + restarts it in a single line, albeit it's not actually a single command. The best solution for me was simply rebuild and restart:
docker-compose build worker && docker-compose restart worker
This accomplishes both major goals at once for me:
worker containerHope this helps anyone else getting here.