langkilde
langkilde

Reputation: 1513

How to check nginx status without systemctl?

I'm running an Nginx webserver in a Alpine container. It appears I cannot use systemctl (https://github.com/moby/moby/issues/2296) without different priviliges, or I get Failed to get D-Bus connection: Unknown error -1. Is there another way to achieve the same thing, i.e. check the status of a running Nginx instance?

Upvotes: 4

Views: 12310

Answers (2)

Alexander Altshuler
Alexander Altshuler

Reputation: 3064

Within container nginx usually runs as the only process (actually the master and some workers), not as any kind of service.

As you can see here official nginx alpine Dockerfile nginx even doesn't run as daemon.

If nginx will quit container will stop running. Just use docker ps to check is your container is in running state.

Usually nginx container fail because bad configuration.

nginx within container forwards request and error logs to docker log collector. The best way to find the reasons why nginx container was not able to start is just docker logs <container-name-or-id>

Upvotes: 1

Calculus
Calculus

Reputation: 781

you could do ps -ef | grep nginx or netstat -a | grep port_num

assuming the process name for nginx is nginx and port_num is the port your server is running on

Upvotes: 6

Related Questions