docker-compose
deploys containers with a configuration to be managed by the docker engine. That restart policy is applied to the container, which is handled by the engine. When the engine restarts a container, the previous container state is maintained. The only exception is a tmpfs filesystem mount inside your container which will reset to an empty directory.
However, if your service is managed by swarm mode instead of docker-compose, the default changes to recreate any failed containers instead of just restarting them. You can configure a single node swarm cluster with:
docker swarm init
And then you can deploy your service with:
docker stack deploy -c docker-compose.yml your-app
Note that with swarm mode you do not need to define the restart policy. Swarm mode will correct any difference from the target state, whether the container exits, fails a health check, or gets deleted, the response will be to deploy a new container.