Fedora 32にDcokerを利用してnginxコンテナを起動する
1.dockerバージョンの確認
[root@localhost ~]# docker -v Docker version 20.10.7, build f0df350
OSバージョンの確認
[root@localhost ~]# cat /etc/fedora-release Fedora release 32 (Thirty Two)
2.ファイアウォールを設定
[root@localhost ~]# firewall-cmd --zone=public --add-port=8889/tcp --permanent success
nginxコンテナを起動
[root@localhost ~]# docker run --name test -d -p 8889:80 nginx Unable to find image 'nginx:latest' locally latest: Pulling from library/nginx b380bbd43752: Pull complete fca7e12d1754: Pull complete 745ab57616cb: Pull complete a4723e260b6f: Pull complete 1c84ebdff681: Pull complete 858292fd2e56: Pull complete Digest: sha256:644a70516a26004c97d0d85c7fe1d0c3a67ea8ab7ddf4aff193d9f301670cf36 Status: Downloaded newer image for nginx:latest 5a1dc553fc37a30c6d0fcc010cd2f747d9fe8309d5ee3d5cb4e681a90055f7bf
3.nginxバージョンの確認
[root@localhost ~]# curl -I http://localhost:8889 HTTP/1.1 200 OK Server: nginx/1.21.3 Date: Sun, 17 Oct 2021 08:32:01 GMT Content-Type: text/html Content-Length: 615 Last-Modified: Tue, 07 Sep 2021 15:21:03 GMT Connection: keep-alive ETag: "6137835f-267" Accept-Ranges: bytes
4.画面確認
http://192.168.71.136:8889/
「Welcome to nginx!」が表示されます。