# docker compose ps -a
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
containers-nginx-1 nginx:latest "/docker-entrypoint.…" nginx About an hour ago Up About an hour 0.0.0.0:80->80/tcp, :::80->80/tcp
containers-php-1 php:latest "docker-php-entrypoi…" php About an hour ago Exited (0) About an hour ago
containers-php-fpm-1 php:8-fpm "docker-php-entrypoi…" php-fpm 12 minutes ago Exited (0) 7 minutes ago
containers-web-1 nginx:latest "/docker-entrypoint.…" web 12 minutes ago Created
I want to stop the Nginx:
# docker compose stop nginx
no such service: nginx
And:
# ss -tupln
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port
tcp LISTEN 0 4096 0.0.0.0:80 0.0.0.0:* users:(("docker-proxy",pid=5146,fd=4))
tcp LISTEN 0 4096 [::]:80 [::]:* users:(("docker-proxy",pid=5153,fd=4))
The service name looks right. Check the version of docker compose and update it if there i a newer release.
Or maybe there was an nginx service but it is not in the compsoe file anymore. I haven’t checked what happens in that case, but if it is the case, it is still inconsistent as it should be able to stop the container that it can list.
That seems right. Can you also share the compose file or create a new compose file for us that can reproduce the issue? The latest compose can have bugs as well. Maybe you can try to downgrade it.
I assume you installed Docker from the official repo: