Docker 배포 Nginx 응용 프로그램 (2)
1. Nginx 미 러 추출
[root@localhost ~]# docker pull nginx
Using default tag: latest
latest: Pulling from library/nginx
f7e2b70d04ae: Pull complete
08dd01e3f3ac: Pull complete
d9ef3a1eb792: Pull complete
Digest: sha256:98efe605f61725fd817ea69521b0eeb32bef007af0e3d0aeb6258c6e6fe7fc1a
Status: Downloaded newer image for nginx:latest
2. 당 겨 진 미 러 보기
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest 881bd08c0b08 7 days ago 109MB
3 、 Docker 에서 Nginx 사용 하기
[root@localhost ~]# docker run -p 80:80 --name myNginx -d nginx
ad7cc45c81ffadbd44254c1c043e048c677a4ebcd4ca618efcd098729cec2fa5
4. 시작 하 는 nginx 프로 세 스 보기
[root@localhost ~]# ps -ef|grep nginx
root 13223 13208 0 05:50 ? 00:00:00 nginx: master process nginx -g daemon off;
101 13253 13223 0 05:50 ? 00:00:00 nginx: worker process
root 13262 12350 0 05:50 pts/1 00:00:00 grep --color=auto nginx
5. nginx 방문
[root@localhost ~]# curl http://localhost:80/
<head>
Welcome to nginx!
head>
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.
For online documentation and support please refer to
"http://nginx.org/">nginx.org.
Commercial support is available at
"http://nginx.com/">nginx.com.
Thank you for using nginx.
6. Nginx 참조 상태 모니터링
[root@localhost ~]# docker inspect ad7cc45c81ffadbd44254c1c043e048c677a4ebcd4ca618efcd098729cec2fa5
[
{
"Id": "ad7cc45c81ffadbd44254c1c043e048c677a4ebcd4ca618efcd098729cec2fa5",
"Created": "2019-03-12T09:58:06.595522099Z",
"Path": "nginx",
"Args": [
"-g",
"daemon off;"
],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 13411,
"ExitCode": 0,
"Error": "",
"StartedAt": "2019-03-12T09:58:07.12571162Z",
"FinishedAt": "0001-01-01T00:00:00Z"
},
"Image": "sha256:881bd08c0b08234bd19136957f15e4301097f4646c1e700f7fea26e41fc40069",
"ResolvConfPath": "/var/lib/docker/containers/ad7cc45c81ffadbd44254c1c043e048c677a4ebcd4ca618efcd098729cec2fa5/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/ad7cc45c81ffadbd44254c1c043e048c677a4ebcd4ca618efcd098729cec2fa5/hostname",
"HostsPath": "/var/lib/docker/containers/ad7cc45c81ffadbd44254c1c043e048c677a4ebcd4ca618efcd098729cec2fa5/hosts",
"LogPath": "/var/lib/docker/containers/ad7cc45c81ffadbd44254c1c043e048c677a4ebcd4ca618efcd098729cec2fa5/ad7cc45c81ffadbd44254c1c043e048c677a4ebcd4ca618efcd098729cec2fa5-json.log",
"Name": "/myNginx",
"RestartCount": 0,
"Driver": "overlay2",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": null,
"HostConfig": {
"Binds": null,
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "default",
"PortBindings": {
"80/tcp": [
{
"HostIp": "",
"HostPort": "80"
}
]
},
"RestartPolicy": {
"Name": "no",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": null,
"CapAdd": null,
"CapDrop": null,
"Dns": [],
"DnsOptions": [],
"DnsSearch": [],
"ExtraHosts": null,
"GroupAdd": null,
"IpcMode": "shareable",
"Cgroup": "",
"Links": null,
"OomScoreAdj": 0,
"PidMode": "",
"Privileged": false,
"PublishAllPorts": false,
"ReadonlyRootfs": false,
"SecurityOpt": null,
"UTSMode": "",
"UsernsMode": "",
"ShmSize": 67108864,
"Runtime": "runc",
"ConsoleSize": [
0,
0
],
"Isolation": "",
"CpuShares": 0,
"Memory": 0,
"NanoCpus": 0,
"CgroupParent": "",
"BlkioWeight": 0,
"BlkioWeightDevice": [],
"BlkioDeviceReadBps": null,
"BlkioDeviceWriteBps": null,
"BlkioDeviceReadIOps": null,
"BlkioDeviceWriteIOps": null,
"CpuPeriod": 0,
"CpuQuota": 0,
"CpuRealtimePeriod": 0,
"CpuRealtimeRuntime": 0,
"CpusetCpus": "",
"CpusetMems": "",
"Devices": [],
"DeviceCgroupRules": null,
"DiskQuota": 0,
"KernelMemory": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": null,
"OomKillDisable": false,
"PidsLimit": 0,
"Ulimits": null,
"CpuCount": 0,
"CpuPercent": 0,
"IOMaximumIOps": 0,
"IOMaximumBandwidth": 0,
"MaskedPaths": [
"/proc/asound",
"/proc/acpi",
"/proc/kcore",
"/proc/keys",
"/proc/latency_stats",
"/proc/timer_list",
"/proc/timer_stats",
"/proc/sched_debug",
"/proc/scsi",
"/sys/firmware"
],
"ReadonlyPaths": [
"/proc/bus",
"/proc/fs",
"/proc/irq",
"/proc/sys",
"/proc/sysrq-trigger"
]
},
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/bc9ef8c119903b79ec581081d835c447ce00b72eb70b07b45d14b3dde7a37c51-init/diff:/var/lib/docker/overlay2/2f3362aabe1d926214bed5c53a425fde596d23861cc6a59168c594974623876a/diff:/var/lib/docker/overlay2/56da5031c7fb61e617765323e953cd71e07679f202f56df818342500f409b50b/diff:/var/lib/docker/overlay2/1321013bc28d4931f52ab6cc47de24b57c6221686aa25c1acea18c7f87131070/diff",
"MergedDir": "/var/lib/docker/overlay2/bc9ef8c119903b79ec581081d835c447ce00b72eb70b07b45d14b3dde7a37c51/merged",
"UpperDir": "/var/lib/docker/overlay2/bc9ef8c119903b79ec581081d835c447ce00b72eb70b07b45d14b3dde7a37c51/diff",
"WorkDir": "/var/lib/docker/overlay2/bc9ef8c119903b79ec581081d835c447ce00b72eb70b07b45d14b3dde7a37c51/work"
},
"Name": "overlay2"
},
"Mounts": [],
"Config": {
"Hostname": "ad7cc45c81ff",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"80/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"NGINX_VERSION=1.15.9-1~stretch",
"NJS_VERSION=1.15.9.0.2.8-1~stretch"
],
"Cmd": [
"nginx",
"-g",
"daemon off;"
],
"ArgsEscaped": true,
"Image": "nginx",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": {
"maintainer": "NGINX Docker Maintainers "
},
"StopSignal": "SIGTERM"
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "c107fe699256ce2babfe253697e8920386d06d86dae4d91be13c0b6cca00aa08",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"80/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "80"
}
]
},
"SandboxKey": "/var/run/docker/netns/c107fe699256",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "88fa96a128cc924a9117cae0f720609ed70cad716892da3baf598e7f58a03ecc",
"Gateway": "172.17.0.1",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"MacAddress": "02:42:ac:11:00:02",
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "43fd51e168684e9ecd3684cf50beff2305983c747083d35e2b8a04d3470d775b",
"EndpointID": "88fa96a128cc924a9117cae0f720609ed70cad716892da3baf598e7f58a03ecc",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:11:00:02",
"DriverOpts": null
}
}
}
}
]
7. Nginx 응용 프로그램 중지
[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ad7cc45c81ff nginx "nginx -g 'daemon of…" 23 seconds ago Up 23 seconds 0.0.0.0:80->80/tcp myNginx
[root@localhost ~]# docker stop ad7cc45c81ff
ad7cc45c81ff
8. Nginx 프로 세 스 보기, 80 포트 방문
[root@localhost ~]# ps -ef|grep nginx
root 13319 12350 0 05:50 pts/1 00:00:00 grep --color=auto nginx
[root@localhost ~]# curl http://localhost:80/
curl: (7) Failed connect to localhost:80; Connection refused
9. Nginx 응용 Container 삭제 docker rm -f xxx)
[root@localhost ~]# docker stop ad7cc45c81ff
ad7cc45c81ff
[root@localhost ~]# docker rm ad7cc45c81ff
ad7cc45c81ff
10. Docker 의 Nginx 응용 은 호스트 8899 포트 에 매 핑 됩 니 다.
[root@localhost ~]# curl http://localhost:8899/
curl: (7) Failed connect to localhost:8899; Connection refused
[root@localhost ~]# docker run -p 8899:80 --name myNginx -d nginx
598c5f3d52e0511480eebb031c2cdee05b155054edd014ca22ca1bef49d62867
[root@localhost ~]# curl http://localhost:8899/
<head>
Welcome to nginx!
head>
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.
For online documentation and support please refer to
"http://nginx.org/">nginx.org.
Commercial support is available at
"http://nginx.com/">nginx.com.
Thank you for using nginx.
다음으로 전송:https://www.cnblogs.com/wrcold520/p/10518464.html
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
셸 입문 부터 정통 한 for 순환 및 6 가지 난수 생 성 법순환 용 1. [문법 구조] 2. 문법 linux 에서 무 작위 수 를 만 드 는 여섯 가지 방법 방법 1: 방법 2: openssl 을 통 해 난수 생 성 방법 3: date 시간 을 통 해 얻 을 수 있 습 니 ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.