Recreate single docker-compose container with new config

If I make changes to my docker-compose.yml (say, change which host port a container port is exposed on), can I recreate that single container or do I need to restart the whole stack?

docker-compose stop ; docker-compose up will do the job but I want to avoid restarting the rest of the services. I also want to avoid deleting volumes associated with the service that I'm restarting, so docker-compose kill <service> ; docker-compose rm is not an option.


Just run docker-compose up again. Everything that is impacted by your change (container, volume, network, etc.) is going to be recreated, the other containers will stay.

If you want to use newer images, run docker-compose pull beforehand.