restarting the container is not recommended when initializing Docker Swarm, as it can remove the nginx service. Therefore, if you need an alternative to docker restart ; You can enter the container and just run nginx -s reload
For example, in docker env, if you have a container named nginx
docker exec <nginx_container_id> nginx -s reload
source share