Restart Single Container While Using Docker Compose

07-23-2020

When you’re running a set of containers with Docker Compose there are times that you need to restart just one of those containers. Let’s say for example that you need to restart your NodeJS server to read in a new environment setting. You could stop and restart the entire stack OR you could run this command:

Find the container

1
docker ps
1
docker container restart < container id >

This will restart the container, reading in new settings while maintaining all of the configurations from Docker Compose. For more information, here are the Docker Docs