Wednesday, January 22, 2020

Docker - Install nginx


Download, install and start a container running NGINX

$ sudo docker run --detach --name web nginx:latest
Unable to find image 'nginx:latest' locally
latest: Pulling from library/nginx
8ec398bc0356: Pull complete
dfb2a46f8c2c: Pull complete
b65031b6a2a5: Pull complete
Digest: sha256:80a88760216ae16b13d9a9ce0267740d2de3506cbf1cab29072b1532dedd1ecb
Status: Downloaded newer image for nginx:latest
11292f469c3db9b1a1ec66cf46d5133803be823bbd89e91613d39133757436a1



Check if nginx process has started

$ ps aux | head -1; ps aux | grep nginx
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root      7632  0.1  0.0  10632  5540 ?        Ss   12:18   0:00 nginx: master process nginx -g daemon off;
systemd+  7691  0.0  0.0  11088  2664 ?        S    12:18   0:00 nginx: worker process







Check Docker running Process:

$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
11292f469c3d        nginx:latest        "nginx -g 'daemon of…"   2 hours ago         Up 2 hours          80/tcp              web