Since we introduced nginx using Docker, the contents are summarized below.
Docker hub URL https://hub.docker.com/_/nginx
Copy the contents of the black box on the upper right of the link destination
% docker pull nginx
The nginx image is installed.
↓ Confirmation
% docker images
nginx latest f35646e83998 3 weeks ago 133MB
% docker run -it -p 8080:80 nginx bin/bash
-it can fit inside a container It seems that it is local 8080 that accesses port 80 of the virtual environment.
% apt update && apt install -y vim
% vi /etc/nginx/nginx.conf
Return with: q!
apt update && apt install -y procps
% ps aux
Access localhost: 8080 port → Start
If it is displayed like this, nginx has started successfully.
% nginx -s stop
Control + D
docker commit container ID new name create new docker
% docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest f35646e83998 3 weeks ago 133MB
docker commit 4fe63b604f41 nginx-new
A new image of nginx-new is created.
% docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest f35646e83998 3 weeks ago 133MB
nginx-new latest 9b8e8bcd32fe 33 minutes ago 185MB
Recommended Posts