Ignoring the restart policy for running on-off commands on the same docker image used for long-running services

I am using the option to restart my docker instances in my docker-compose file like:

restart: always

The problem is that sometimes I run a single docker container for maintenance work like:

docker-compose run rails rake db:migrate 

The issue with this is when I do a ‘docker ps’ I can see those on-off commands are still running and constantly being restarted:

“rake db:migrate” 2 days ago Restarting (7) 18 seconds
ago

Is there a way to run a docker image that is for on-off purposes, but still have the restart policy on it but somehow ignore it for this single instance usage?

Source: StackOverflow